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

Commit fb80d77

Browse files
authored
FEATURE: Enable gists on all topic lists (#922)
1 parent 48d08de commit fb80d77

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

assets/javascripts/discourse/components/ai-topic-gist.gjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ export default class AiTopicGist extends Component {
1212

1313
get showGist() {
1414
return (
15-
this.router.currentRoute.attributes?.filterType === "hot" &&
1615
this.args.topic?.ai_topic_gist &&
17-
!this.args.topic?.excerpt &&
1816
this.prefersGist &&
1917
!this.args.topic?.excerpt
2018
);

lib/summarization/entry_point.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def inject_into(plugin)
1818
end
1919

2020
plugin.register_modifier(:topic_query_create_list_topics) do |topics, options|
21-
if options[:filter] == :hot && SiteSetting.ai_summarization_enabled &&
21+
skipped_filters = %i[suggested semantic_related]
22+
23+
if !skipped_filters.include?(options[:filter]) && SiteSetting.ai_summarization_enabled &&
2224
SiteSetting.ai_summarize_max_hot_topics_gists_per_batch > 0
2325
topics.includes(:ai_summaries).where(
2426
"ai_summaries.id IS NULL OR ai_summaries.summary_type = ?",
@@ -34,9 +36,7 @@ def inject_into(plugin)
3436
:ai_topic_gist,
3537
include_condition: -> { scope.can_see_gists? },
3638
) do
37-
# Options is defined at the instance level so we cannot run this check inside "include_condition".
38-
return if options[:filter] != :hot
39-
39+
return if %i[suggested semantic_related].include?(options[:filter])
4040
summaries = object.ai_summaries.to_a
4141

4242
# Summaries should always have one or zero elements here.

spec/lib/modules/summarization/entry_point_spec.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,6 @@
7171
expect(serialized[:ai_topic_gist]).to be_present
7272
end
7373

74-
it "doesn't include the summary when looking at other topic lists" do
75-
gist_topic = topic_query.list_hot.topics.find { |t| t.id == topic_ai_gist.target_id }
76-
77-
serialized =
78-
TopicListItemSerializer.new(
79-
gist_topic,
80-
scope: Guardian.new(user),
81-
root: false,
82-
filter: :latest,
83-
).as_json
84-
85-
expect(serialized[:ai_topic_gist]).to be_nil
86-
end
87-
8874
it "doesn't include the summary when the user is not a member of the opt-in group" do
8975
SiteSetting.ai_hot_topic_gists_allowed_groups = ""
9076

0 commit comments

Comments
 (0)