2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FIX: DiscourseEvent should not be triggered from within the controller.

This commit is contained in:
Guo Xiang Tan 2016-09-05 15:58:04 +08:00
parent ec90655c41
commit aabb7a8592
3 changed files with 41 additions and 20 deletions

View file

@ -47,6 +47,7 @@ class PostDestroyer
mark_for_deletion
end
DiscourseEvent.trigger(:post_destroyed, @post, @opts, @user)
DiscourseEvent.trigger(:topic_destroyed, @topic, @user) if @post.is_first_post?
end
def recover
@ -60,6 +61,7 @@ class PostDestroyer
topic.update_statistics
recover_user_actions
DiscourseEvent.trigger(:post_recovered, @post, @opts, @user)
DiscourseEvent.trigger(:topic_recovered, topic, @user) if @post.is_first_post?
end
def staff_recovered