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

Commit dcde94a

Browse files
authored
FIX: Reduce scope of topic gists inclusion. (#925)
The topic query is used differently, and we can't assume the modifier will always receive an AR relation. Let's scope it to `Discourse#filters` instead of most lists.
1 parent 3c91f37 commit dcde94a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/summarization/entry_point.rb

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

2020
plugin.register_modifier(:topic_query_create_list_topics) do |topics, options|
21-
skipped_filters = %i[suggested semantic_related private_messages]
22-
23-
if !skipped_filters.include?(options[:filter]) && SiteSetting.ai_summarization_enabled &&
21+
if Discourse.filters.include?(options[:filter]) && SiteSetting.ai_summarization_enabled &&
2422
SiteSetting.ai_summarize_max_hot_topics_gists_per_batch > 0
2523
topics.includes(:ai_summaries).where(
2624
"ai_summaries.id IS NULL OR ai_summaries.summary_type = ?",
@@ -36,7 +34,7 @@ def inject_into(plugin)
3634
:ai_topic_gist,
3735
include_condition: -> { scope.can_see_gists? },
3836
) do
39-
return if %i[suggested semantic_related private_messages].include?(options[:filter])
37+
return if !Discourse.filters.include?(options[:filter])
4038
summaries = object.ai_summaries.to_a
4139

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

0 commit comments

Comments
 (0)