mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
Add a new event for when a post is confirmed as spam
This commit is contained in:
parent
0a252d7785
commit
06279b5c6a
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user