mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:10:17 +08:00
Merge pull request #3473 from binaryage/hipchat-plugin
Add missing events for discourse-hipchat-plugin
This commit is contained in:
commit
48f4fe7e7a
|
@ -261,6 +261,8 @@ class TopicsController < ApplicationController
|
|||
first_post = topic.ordered_posts.first
|
||||
PostDestroyer.new(current_user, first_post, { context: params[:context] }).destroy
|
||||
|
||||
DiscourseEvent.trigger(:topic_destroyed, topic, current_user)
|
||||
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
|
@ -271,6 +273,8 @@ class TopicsController < ApplicationController
|
|||
first_post = topic.posts.with_deleted.order(:post_number).first
|
||||
PostDestroyer.new(current_user, first_post).recover
|
||||
|
||||
DiscourseEvent.trigger(:topic_recovered, topic, current_user)
|
||||
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ class PostDestroyer
|
|||
elsif @user.id == @post.user_id
|
||||
mark_for_deletion
|
||||
end
|
||||
DiscourseEvent.trigger(:post_destroyed, @post, @opts, @user)
|
||||
end
|
||||
|
||||
def recover
|
||||
|
@ -57,6 +58,7 @@ class PostDestroyer
|
|||
topic = Topic.with_deleted.find @post.topic_id
|
||||
topic.recover! if @post.is_first_post?
|
||||
topic.update_statistics
|
||||
DiscourseEvent.trigger(:post_recovered, @post, @opts, @user)
|
||||
end
|
||||
|
||||
def staff_recovered
|
||||
|
|
Loading…
Reference in New Issue
Block a user