This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,7 @@ def execute(args)
1414
1515 summarizer = DiscourseAi ::Summarization . topic_gist ( topic )
1616 gist = summarizer . existing_summary
17- return if gist . blank?
18- return if !gist . outdated
17+ return if gist . present? && !gist . outdated
1918
2019 summarizer . force_summarize ( Discourse . system_user )
2120 end
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- RSpec . describe Jobs ::UpdateHotTopicGist do
3+ RSpec . describe Jobs ::FastTrackTopicGist do
44 describe "#execute" do
55 fab! ( :topic_1 ) { Fabricate ( :topic ) }
66 fab! ( :post_1 ) { Fabricate ( :post , topic : topic_1 , post_number : 1 ) }
1212 SiteSetting . ai_summarize_max_hot_topics_gists_per_batch = 100
1313 end
1414
15- context "when the hot topic has a gist" do
16- before { TopicHotScore . create! ( topic_id : topic_1 . id , score : 0.1 ) }
15+ context "when the topic has a gist" do
1716 fab! ( :ai_gist ) do
1817 Fabricate ( :topic_ai_gist , target : topic_1 , original_content_sha : AiSummary . build_sha ( "12" ) )
1918 end
4847 end
4948
5049 context "when the topic doesn't have a hot topic score" do
51- it "does nothing " do
52- subject . execute ( { } )
50+ it "creates gist " do
51+ subject . execute ( topic_id : topic_1 . id )
5352
5453 gist = AiSummary . gist . find_by ( target : topic_1 )
55- expect ( gist ) . to be_nil
54+ expect ( gist ) . to be_present
5655 end
5756 end
5857
5958 context "when the topic has a hot topic score but no gist" do
6059 before { TopicHotScore . create! ( topic_id : topic_1 . id , score : 0.1 ) }
6160
62- it "does nothing " do
63- subject . execute ( { } )
61+ it "creates gist " do
62+ subject . execute ( topic_id : topic_1 . id )
6463
6564 gist = AiSummary . gist . find_by ( target : topic_1 )
66- expect ( gist ) . to be_nil
65+ expect ( gist ) . to be_present
6766 end
6867 end
6968 end
You can’t perform that action at this time.
0 commit comments