FEATURE: when a post is deleted because a moderator agreed with flags, send a message to the post author

This commit is contained in:
Neil Lalonde
2018-07-24 17:17:47 -04:00
parent e4480ad0d2
commit fe39cdc90a
4 changed files with 42 additions and 15 deletions

View File

@@ -196,6 +196,15 @@ class PostDestroyer
end
def agree_with_flags
if @post.is_flagged?
Jobs.enqueue(
:send_system_message,
user_id: @post.user.id,
message_type: :flags_agreed_and_post_deleted,
message_options: { url: @post.url }
)
end
PostAction.agree_flags!(@post, @user, delete_post: true)
end