Files
fizzy/app/models/comment.rb
T
Jason Zimdars 485e575c40 Merge branch 'main' into card-attachments
* main: (45 commits)
  Display tag counts in the filter menu
  Move Add Card button to header
  Re-write help content, try a modal-like display
  Move to internal registry
  Show date instead of time for notifications older than 1 day
  Ensure checks are visible for tags and assignments
  Adjust padding so card number isn't cut off
  Don't color the collection header in considering
  Golden cards bubble to the top of Considering, too
  Adjust card collection header when colored golden
  Allow cards in Considering to gilded
  Hide focus ring on new card titles and step inputs
  Add hover effect for comment edit button
  Add hover effect to overflow button
  Improve multi-account behavior of the PWA
  Remove unneeded *
  Rename test
  Review the code to move cards
  Update editor
  Generalize and delete mentions too
  ...
2025-07-08 16:04:14 -05:00

26 lines
607 B
Ruby

class Comment < ApplicationRecord
include Attachments, Eventable, Mentions, Searchable
belongs_to :card, touch: true
belongs_to :creator, class_name: "User", default: -> { Current.user }
has_many :reactions, dependent: :delete_all
has_rich_text :body
searchable_by :body, using: :comments_search_index
scope :chronologically, -> { order created_at: :asc, id: :desc }
after_create_commit :watch_card_by_creator
delegate :collection, :watch_by, to: :card
def to_partial_path
"cards/#{super}"
end
private
def watch_card_by_creator
card.watch_by creator
end
end