From dfda153ffa5c7ace91dcf14e79f8db459ea62641 Mon Sep 17 00:00:00 2001 From: Michael Verdi Date: Tue, 9 Dec 2014 11:42:24 -0800 Subject: [PATCH] [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. --- lib/post_destroyer.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/post_destroyer.rb b/lib/post_destroyer.rb index 9bba2444d..ae4e6a558 100644 --- a/lib/post_destroyer.rb +++ b/lib/post_destroyer.rb @@ -54,8 +54,9 @@ class PostDestroyer elsif @user.staff? || @user.id == @post.user_id user_recovered end - @post.topic.recover! if @post.post_number == 1 - @post.topic.update_statistics + topic = Topic.with_deleted.find @post.topic_id + topic.recover! if @post.post_number == 1 + topic.update_statistics end def staff_recovered