mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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_id: post.id)
|
||||||
.where(post_action_type_id: PostActionType.flag_types.values)
|
.where(post_action_type_id: PostActionType.flag_types.values)
|
||||||
|
|
||||||
|
trigger_spam = false
|
||||||
actions.each do |action|
|
actions.each do |action|
|
||||||
action.agreed_at = Time.zone.now
|
action.agreed_at = Time.zone.now
|
||||||
action.agreed_by_id = moderator.id
|
action.agreed_by_id = moderator.id
|
||||||
# so callback is called
|
# so callback is called
|
||||||
action.save
|
action.save
|
||||||
action.add_moderator_post_if_needed(moderator, :agreed, delete_post)
|
action.add_moderator_post_if_needed(moderator, :agreed, delete_post)
|
||||||
|
@trigger_spam = true if action.post_action_type_id == PostActionType.types[:spam]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
DiscourseEvent.trigger(:confirmed_spam_post, post) if @trigger_spam
|
||||||
|
|
||||||
update_flagged_posts_count
|
update_flagged_posts_count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user