A platform for community discussion. Free, open, simple.
Remove force summary mode for megatopics for now.
Guo Xiang Tan0b6a2e9d1fe9
diff --git a/app/assets/javascripts/discourse/lib/transform-post.js.es6 b/app/assets/javascripts/discourse/lib/transform-post.js.es6index dbdc8c0246f..80106ecc0b3 100644--- a/app/assets/javascripts/discourse/lib/transform-post.js.es6+++ b/app/assets/javascripts/discourse/lib/transform-post.js.es6@@ -177,14 +177,9 @@ export default function transformPost(const postStream = topic.get("postStream");postAtts.userFilters = postStream.userFilters;-- if (topic.force_summary_mode) {- postStream.set("summary", topic.force_summary_mode);- }-postAtts.topicSummaryEnabled = postStream.summary;postAtts.topicWordCount = topic.word_count;- postAtts.hasTopicSummary = topic.has_summary || topic.force_summary_mode;+ postAtts.hasTopicSummary = topic.has_summary;}if (postAtts.isDeleted) {diff --git a/app/serializers/topic_view_serializer.rb b/app/serializers/topic_view_serializer.rbindex 5044aa6177d..15b23ab66cd 100644--- a/app/serializers/topic_view_serializer.rb+++ b/app/serializers/topic_view_serializer.rb@@ -67,8 +67,7 @@ class TopicViewSerializer < ApplicationSerializer:message_bus_last_id,:participant_count,:destination_category_id,- :pm_with_non_human_user,- :force_summary_mode,+ :pm_with_non_human_user# TODO: Split off into proper object / serializerdef details@@ -300,10 +299,6 @@ class TopicViewSerializer < ApplicationSerializerobject.topic.shared_draft.present?end- def force_summary_mode- object.force_summary_mode?- end-privatedef private_message?(topic)diff --git a/app/serializers/web_hook_topic_view_serializer.rb b/app/serializers/web_hook_topic_view_serializer.rbindex 3cb1754280b..1aa71ccfd19 100644--- a/app/serializers/web_hook_topic_view_serializer.rb+++ b/app/serializers/web_hook_topic_view_serializer.rb@@ -20,7 +20,6 @@ class WebHookTopicViewSerializer < TopicViewSerializertopic_timerprivate_topic_timerdetails- force_summary_mode}.each do |attr|define_method("include_#{attr}?") dofalsediff --git a/lib/topic_view.rb b/lib/topic_view.rbindex 20ee45b3db7..0a0ae5a9aab 100644--- a/lib/topic_view.rb+++ b/lib/topic_view.rb@@ -406,13 +406,6 @@ class TopicViewendend- def force_summary_mode?- @force_summary_mode ||=- @filter != 'none' &&- @topic.closed? &&- @topic.posts_count >= (MEGA_TOPIC_POSTS_COUNT * 2)- end-protecteddef read_posts_set@@ -490,11 +483,9 @@ class TopicView@filtered_posts = unfiltered_posts# Filters- if @filter == 'summary' ||- ((@_post_number.blank? || @_post_number.to_i == 1) && force_summary_mode?)-+ if @filter == 'summary'@filtered_posts = @filtered_posts.summary(@topic.id)- @contains_gaps = true unless force_summary_mode?+ @contains_gaps = trueendif @best.present?diff --git a/spec/components/topic_view_spec.rb b/spec/components/topic_view_spec.rbindex 211933064d7..17e1eedcafb 100644--- a/spec/components/topic_view_spec.rb+++ b/spec/components/topic_view_spec.rb@@ -364,42 +364,6 @@ describe TopicView doendend- describe 'when a megalodon topic is closed' do- before do- @original_const = TopicView::MEGA_TOPIC_POSTS_COUNT- TopicView.send(:remove_const, "MEGA_TOPIC_POSTS_COUNT")- TopicView.const_set("MEGA_TOPIC_POSTS_COUNT", 1)- topic.update!(closed: true)- SiteSetting.summary_max_results = 2- end-- after do- TopicView.send(:remove_const, "MEGA_TOPIC_POSTS_COUNT")- TopicView.const_set("MEGA_TOPIC_POSTS_COUNT", @original_const)- end-- it 'should be forced into summary mode without gaps' do- topic_view = TopicView.new(topic.id, evil_trout, post_number: 1)-- expect(topic_view.contains_gaps?).to eq(false)- expect(topic_view.posts).to eq([p5])- end-- it 'should not be forced into summary mode if post_number is not blank' do- topic_view = TopicView.new(topic.id, evil_trout, post_number: 2)-- expect(topic_view.contains_gaps?).to eq(false)- expect(topic_view.posts).to eq([p1, p2, p3])- end-- it 'should not be forced into summary mode if filter is none' do- topic_view = TopicView.new(topic.id, evil_trout, filter: 'none')-- expect(topic_view.contains_gaps?).to eq(false)- expect(topic_view.posts).to eq([p1, p2, p3])- end- end-it "#restricts to correct topic" dot2 = Fabricate(:topic)