[bug fix] When recovering a post, at times the topic related to the post still returns nil.

Use the with_deleted method to include topics that have been soft deleted so that they too can
be recovered.
This commit is contained in:
Michael Verdi 2014-12-09 11:42:24 -08:00
parent 663cd93c6d
commit dfda153ffa

View file

@ -54,8 +54,9 @@ class PostDestroyer
elsif @user.staff? || @user.id == @post.user_id elsif @user.staff? || @user.id == @post.user_id
user_recovered user_recovered
end end
@post.topic.recover! if @post.post_number == 1 topic = Topic.with_deleted.find @post.topic_id
@post.topic.update_statistics topic.recover! if @post.post_number == 1
topic.update_statistics
end end
def staff_recovered def staff_recovered