Create the ability to send reports to moderators
- Limited to Builders+ -- Moderator+ can also use as they may be too busy ATM - Only on users, comments, and forum posts - Multiple reports can be generated per instance - Primarily posts to a moderator-only topic for viewability - Secondarily has a table for searchability -- Viewable only by moderators
This commit is contained in:
@@ -7,6 +7,7 @@ class Comment < ApplicationRecord
|
||||
belongs_to :post
|
||||
belongs_to_creator
|
||||
belongs_to_updater
|
||||
has_many :moderation_reports, as: :model
|
||||
has_many :votes, :class_name => "CommentVote", :dependent => :destroy
|
||||
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|
|
||||
@@ -127,6 +128,10 @@ class Comment < ApplicationRecord
|
||||
updater_id == user.id || user.is_moderator?
|
||||
end
|
||||
|
||||
def reportable_by?(user)
|
||||
user.is_builder? && creator_id != user.id && !creator.is_moderator?
|
||||
end
|
||||
|
||||
def voted_by?(user)
|
||||
return false if user.is_anonymous?
|
||||
user.id.in?(votes.map(&:user_id))
|
||||
|
||||
Reference in New Issue
Block a user