Force summary mode when user enters at the top of megalodoon topics.

This commit is contained in:
Guo Xiang Tan
2018-06-21 15:18:52 +08:00
parent f7d22bad90
commit 9a7a079f4d
4 changed files with 35 additions and 21 deletions

View File

@@ -405,6 +405,11 @@ class TopicView
end
end
def force_summary_mode?
@force_summary_mode ||=
(@topic.closed? && @topic.posts_count >= (MEGA_TOPIC_POSTS_COUNT * 2))
end
protected
def read_posts_set
@@ -482,7 +487,7 @@ class TopicView
@filtered_posts = unfiltered_posts
# Filters
if @filter == 'summary' || force_summary_mode?
if @filter == 'summary' || ((@post_number.blank? || @post_number.to_i == 1) && force_summary_mode?)
@filtered_posts = @filtered_posts.summary(@topic.id)
@contains_gaps = true unless force_summary_mode?
end
@@ -572,9 +577,4 @@ class TopicView
def is_mega_topic?
@topic.posts_count >= MEGA_TOPIC_POSTS_COUNT
end
def force_summary_mode?
@force_summary_mode ||=
(@topic.closed? && @topic.posts_count >= (MEGA_TOPIC_POSTS_COUNT * 2))
end
end