diff --git a/app/models/comment.rb b/app/models/comment.rb index 372e7f9c4..f9cd4dfc7 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,11 +1,13 @@ class Comment < ApplicationRecord - validates_presence_of :body, :message => "has no content" belongs_to :post belongs_to :creator, class_name: "User" belongs_to_updater + has_many :moderation_reports, as: :model has_many :votes, :class_name => "CommentVote", :dependent => :destroy + validates :body, presence: true + before_create :autoreport_spam after_create :update_last_commented_at_on_create after_update(:if => ->(rec) {(!rec.is_deleted? || !rec.saved_change_to_is_deleted?) && CurrentUser.id != rec.creator_id}) do |rec|