diff --git a/app/models/post_action.rb b/app/models/post_action.rb index b271e24bda1..a33f74d572b 100644 --- a/app/models/post_action.rb +++ b/app/models/post_action.rb @@ -127,14 +127,18 @@ class PostAction < ActiveRecord::Base .where(post_id: post.id) .where(post_action_type_id: PostActionType.flag_types.values) + trigger_spam = false actions.each do |action| action.agreed_at = Time.zone.now action.agreed_by_id = moderator.id # so callback is called action.save action.add_moderator_post_if_needed(moderator, :agreed, delete_post) + @trigger_spam = true if action.post_action_type_id == PostActionType.types[:spam] end + DiscourseEvent.trigger(:confirmed_spam_post, post) if @trigger_spam + update_flagged_posts_count end