FIX: Post without a topic can be destroyed.

This commit is contained in:
Guo Xiang Tan 2016-09-05 19:00:49 +08:00
parent 52c70f8b45
commit 1b2b142f30
1 changed files with 4 additions and 1 deletions

View File

@ -47,7 +47,10 @@ class PostDestroyer
mark_for_deletion
end
DiscourseEvent.trigger(:post_destroyed, @post, @opts, @user)
DiscourseEvent.trigger(:topic_destroyed, @topic, @user) if @post.is_first_post?
if @post.is_first_post? && @post.topic
DiscourseEvent.trigger(:topic_destroyed, @post.topic, @user)
end
end
def recover