diff --git a/app/models/post.rb b/app/models/post.rb index 94e9d8789c8..265b237ffd3 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -240,7 +240,7 @@ class Post < ActiveRecord::Base end def self.summary - where(["(post_number = 1) or (percent_rank <= ?)", SiteSetting.summary_percent_filter.to_f / 100.0]) + where(["(post_number = 1) or (percent_rank <= ?)", SiteSetting.summary_percent_filter.to_f / 100.0]).limit(100) end def update_flagged_posts_count diff --git a/lib/topic_view.rb b/lib/topic_view.rb index d2620cfcbc1..a0f6b072b66 100644 --- a/lib/topic_view.rb +++ b/lib/topic_view.rb @@ -404,7 +404,7 @@ class TopicView closest_posts = filter_post_ids_by("@(post_number - #{post_number})") return nil if closest_posts.empty? - filtered_post_ids.index(closest_posts.first) + filtered_post_ids.index(closest_posts.first) || filtered_post_ids[0] end end