FEATURE: Admins can flag posts so they can review them later. (#12311)

Staff can send a post to the review queue by clicking the "Flag Post" button next to "Take Action...". Clicking it flags the post using the "Notify moderators" score type and hides it. A custom message will be sent to the user.
This commit is contained in:
Roman Rizzi
2021-03-11 08:21:24 -03:00
committed by GitHub
parent 0902e56162
commit 8fcad73b36
10 changed files with 110 additions and 6 deletions

View File

@ -522,7 +522,7 @@ class Post < ActiveRecord::Base
(topic.present? && (topic.private_message? || topic.category&.read_restricted))
end
def hide!(post_action_type_id, reason = nil)
def hide!(post_action_type_id, reason = nil, custom_message: nil)
return if hidden?
reason ||= hidden_at ?
@ -554,11 +554,16 @@ class Post < ActiveRecord::Base
)
}
message = custom_message
if message.nil?
message = hiding_again ? :post_hidden_again : :post_hidden
end
Jobs.enqueue_in(
5.seconds,
:send_system_message,
user_id: user.id,
message_type: hiding_again ? :post_hidden_again : :post_hidden,
message_type: message,
message_options: options
)
end