From 6356c0555c0d975303a646ac9da61e1ab34fd371 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 19 Aug 2016 13:19:08 -0400 Subject: [PATCH] FIX: topic's best post shouldn't be deleted by the author --- app/models/topic.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/topic.rb b/app/models/topic.rb index 3794e7ac3..d328c5c45 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -255,7 +255,7 @@ class Topic < ActiveRecord::Base end def best_post - posts.where(post_type: Post.types[:regular]).order('score desc nulls last').limit(1).first + posts.where(post_type: Post.types[:regular], user_deleted: false).order('score desc nulls last').limit(1).first end def has_flags?