A platform for community discussion. Free, open, simple.
UX: Optionally show a "Summarize" button in topic timeline (#13533)
Penar Musarajab9c63e4ee05
diff --git a/app/assets/javascripts/discourse/app/templates/topic.hbs b/app/assets/javascripts/discourse/app/templates/topic.hbsindex f2a2f32b961..b1ef0e9d81d 100644--- a/app/assets/javascripts/discourse/app/templates/topic.hbs+++ b/app/assets/javascripts/discourse/app/templates/topic.hbs@@ -148,6 +148,7 @@jumpToPostPrompt=(action "jumpToPostPrompt")jumpToIndex=(action "jumpToIndex")replyToPost=(action "replyToPost")+ showSummary=(action "showSummary")toggleMultiSelect=(action "toggleMultiSelect")showTopicSlowModeUpdate=(route-action "showTopicSlowModeUpdate")deleteTopic=(action "deleteTopic")diff --git a/app/assets/javascripts/discourse/app/widgets/toggle-topic-summary.js b/app/assets/javascripts/discourse/app/widgets/toggle-topic-summary.jsindex b97801eee47..82f9dae5ca4 100644--- a/app/assets/javascripts/discourse/app/widgets/toggle-topic-summary.js+++ b/app/assets/javascripts/discourse/app/widgets/toggle-topic-summary.js@@ -38,6 +38,8 @@ export default createWidget("toggle-topic-summary", {this.attach("toggle-summary-description", attrs),this.attach("button", {className: "btn btn-primary",+ icon: attrs.topicSummaryEnabled ? null : "layer-group",+ title: attrs.topicSummaryEnabled ? null : "summary.short_title",label: attrs.topicSummaryEnabled ? "summary.disable" : "summary.enable",action: attrs.topicSummaryEnabled ? "cancelFilter" : "showSummary",}),diff --git a/app/assets/javascripts/discourse/app/widgets/topic-timeline.js b/app/assets/javascripts/discourse/app/widgets/topic-timeline.jsindex 578fe95910b..0d83d2b3f13 100644--- a/app/assets/javascripts/discourse/app/widgets/topic-timeline.js+++ b/app/assets/javascripts/discourse/app/widgets/topic-timeline.js@@ -351,6 +351,23 @@ createWidget("timeline-footer-controls", {const controls = [];const { currentUser, fullScreen, topic, notificationLevel } = attrs;+ if (+ this.siteSettings.summary_timeline_button &&+ !fullScreen &&+ topic.has_summary &&+ !topic.postStream.summary+ ) {+ controls.push(+ this.attach("button", {+ className: "show-summary btn-small",+ icon: "layer-group",+ label: "summary.short_label",+ title: "summary.short_title",+ action: "showSummary",+ })+ );+ }+if (currentUser && !fullScreen) {if (topic.get("details.can_create_post")) {controls.push(diff --git a/app/assets/stylesheets/common/topic-timeline.scss b/app/assets/stylesheets/common/topic-timeline.scssindex b2fe0e9f001..833e84222f1 100644--- a/app/assets/stylesheets/common/topic-timeline.scss+++ b/app/assets/stylesheets/common/topic-timeline.scss@@ -186,6 +186,8 @@margin-top: 1.5em;transition: opacity 0.2s ease-in;display: flex;+ flex-wrap: wrap;+ max-width: 9em;.reply-to-post {margin-right: 0.5em;@@ -195,6 +197,9 @@margin-right: 0;}}+ .show-summary {+ margin-bottom: 0.5em;+ }.start-date {@include unselectable;diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex f038289c6cb..01d08fc3b39 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -1820,6 +1820,8 @@ en:description_time_MF: "There {replyCount, plural, one {is <b>#</b> reply} other {are <b>#</b> replies}} with an estimated read time of <b>{readingTime, plural, one {# minute} other {# minutes}}</b>."enable: "Summarize This Topic"disable: "Show All Posts"+ short_label: "Summarize"+ short_title: "Show a summary of this topic: the most interesting posts as determined by the community"deleted_filter:enabled_description: "This topic contains deleted posts, which have been hidden."diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex faea7bce785..f4c7cb12e4b 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -1536,11 +1536,13 @@ en:enforce_second_factor: "Forces users to enable two-factor authentication. Select 'all' to enforce it to all users. Select 'staff' to enforce it to staff users only."force_https: "Force your site to use HTTPS only. WARNING: do NOT enable this until you verify HTTPS is fully set up and working absolutely everywhere! Did you check your CDN, all social logins, and any external logos / dependencies to make sure they are all HTTPS compatible, too?"same_site_cookies: "Use same site cookies, they eliminate all Cross Site Request Forgery vectors on supported browsers (Lax or Strict). Warning: Strict will only work on sites that force login and use an external auth method."+summary_score_threshold: "The minimum score required for a post to be included in 'Summarize This Topic'"summary_posts_required: "Minimum posts in a topic before 'Summarize This Topic' is enabled. Changes to this setting will be applied retroactively within a week."summary_likes_required: "Minimum likes in a topic before 'Summarize This Topic' is enabled. Changes to this setting will be applied retroactively within a week."summary_percent_filter: "When a user clicks 'Summarize This Topic', show the top % of posts"summary_max_results: "Maximum posts returned by 'Summarize This Topic'"+ summary_timeline_button: "Show a 'Summarize' button in the timeline"enable_personal_messages: "Allow trust level 1 (configurable via min trust level to send messages) users to create messages and reply to messages. Note that staff can always send messages no matter what."enable_system_message_replies: "Allows users to reply to system messages, even if personal messages are disabled"diff --git a/config/site_settings.yml b/config/site_settings.ymlindex c0720cb4672..b99245fd0d9 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -2103,6 +2103,9 @@ uncategorized:summary_likes_required: 1summary_percent_filter: 20summary_max_results: 100+ summary_timeline_button:+ client: true+ default: falseautomatic_topic_heat_values: truediff --git a/lib/svg_sprite/svg_sprite.rb b/lib/svg_sprite/svg_sprite.rbindex fdc7e70e942..bcebe7245e0 100644--- a/lib/svg_sprite/svg_sprite.rb+++ b/lib/svg_sprite/svg_sprite.rb@@ -141,6 +141,7 @@ module SvgSprite"info-circle","italic","key",+ "layer-group","link","list","list-ol",