Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 97ec2c5

Browse files
authored
FEATURE: Show gists everywhere except suggested/related (#995)
1 parent 04c4ff8 commit 97ec2c5

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

assets/javascripts/discourse/services/gists.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,9 @@ export default class Gists extends Service {
77
@tracked preference = localStorage.getItem("topicListLayout");
88

99
get shouldShow() {
10-
const currentRoute = this.router.currentRoute.name;
11-
const isDiscovery = currentRoute.includes("discovery");
12-
const isNotCategories = !currentRoute.includes("categories");
13-
const gistsAvailable =
14-
this.router.currentRoute.attributes?.list?.topics?.some(
15-
(topic) => topic.ai_topic_gist
16-
);
17-
18-
return isDiscovery && isNotCategories && gistsAvailable;
10+
return this.router.currentRoute.attributes?.list?.topics?.some(
11+
(topic) => topic.ai_topic_gist
12+
);
1913
}
2014

2115
setPreference(value) {

lib/summarization/entry_point.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ def inject_into(plugin)
1717
scope.can_see_summary?(object.topic)
1818
end
1919

20+
# Don't add gists to the following topic lists.
21+
gist_skipped_lists = %i[suggested semantic_related]
22+
2023
plugin.register_modifier(:topic_query_create_list_topics) do |topics, options|
21-
if Discourse.filters.include?(options[:filter]) && SiteSetting.ai_summarization_enabled &&
22-
SiteSetting.ai_summary_gists_enabled
24+
if SiteSetting.ai_summarization_enabled && SiteSetting.ai_summary_gists_enabled &&
25+
!gist_skipped_lists.include?(options[:filter])
2326
topics.includes(:ai_gist_summary)
2427
else
2528
topics
@@ -31,7 +34,7 @@ def inject_into(plugin)
3134
:ai_topic_gist,
3235
include_condition: -> { scope.can_see_gists? },
3336
) do
34-
return if !Discourse.filters.include?(options[:filter])
37+
return if gist_skipped_lists.include?(options[:filter])
3538
object.ai_gist_summary&.summarized_text
3639
end
3740

0 commit comments

Comments
 (0)