diff --git a/lib/filter_best_posts.rb b/lib/filter_best_posts.rb index 960ee136f7e..b5171497083 100644 --- a/lib/filter_best_posts.rb +++ b/lib/filter_best_posts.rb @@ -15,7 +15,7 @@ class FilterBestPosts def filter @posts = if @min_replies && @topic.posts_count < @min_replies + 1 - [] + Post.none else filter_posts_liked_by_moderators setup_posts diff --git a/lib/topic_view.rb b/lib/topic_view.rb index 06e5d0921df..0e73dd8af3c 100644 --- a/lib/topic_view.rb +++ b/lib/topic_view.rb @@ -66,7 +66,7 @@ class TopicView filter_posts(options) - if @posts.present? + if @posts if (added_fields = User.whitelisted_user_custom_fields(@guardian)).present? @user_custom_fields = User.custom_fields_for_ids(@posts.pluck(:user_id), added_fields) end @@ -388,7 +388,7 @@ class TopicView max = [max, post_count].min - return @posts = [] if min > max + return @posts = Post.none if min > max min = [[min, max].min, 0].max