Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions assets/javascripts/discourse/services/gists.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ export default class Gists extends Service {
@tracked preference = localStorage.getItem("topicListLayout");

get shouldShow() {
const currentRoute = this.router.currentRoute.name;
const isDiscovery = currentRoute.includes("discovery");
const isNotCategories = !currentRoute.includes("categories");
const gistsAvailable =
this.router.currentRoute.attributes?.list?.topics?.some(
(topic) => topic.ai_topic_gist
);

return isDiscovery && isNotCategories && gistsAvailable;
return this.router.currentRoute.attributes?.list?.topics?.some(
(topic) => topic.ai_topic_gist
);
}

setPreference(value) {
Expand Down
9 changes: 6 additions & 3 deletions lib/summarization/entry_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ def inject_into(plugin)
scope.can_see_summary?(object.topic)
end

# Don't add gists to the following topic lists.
gist_skipped_lists = %i[suggested semantic_related]

plugin.register_modifier(:topic_query_create_list_topics) do |topics, options|
if Discourse.filters.include?(options[:filter]) && SiteSetting.ai_summarization_enabled &&
SiteSetting.ai_summary_gists_enabled
if SiteSetting.ai_summarization_enabled && SiteSetting.ai_summary_gists_enabled &&
!gist_skipped_lists.include?(options[:filter])
topics.includes(:ai_gist_summary)
else
topics
Expand All @@ -31,7 +34,7 @@ def inject_into(plugin)
:ai_topic_gist,
include_condition: -> { scope.can_see_gists? },
) do
return if !Discourse.filters.include?(options[:filter])
return if gist_skipped_lists.include?(options[:filter])
object.ai_gist_summary&.summarized_text
end

Expand Down
Loading