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

Commit c4ad631

Browse files
committed
FIX: Acceptance test not working
`generateSummary()` should only be called **after** the modal is shown, and update helper response in test.
1 parent 9c6ae5b commit c4ad631

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

assets/javascripts/discourse/components/modal/ai-summary-modal.gjs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,6 @@ export default class AiSummaryModal extends Component {
203203
this.dMenu = api;
204204
}
205205

206-
@action
207-
handleDidInsert() {
208-
this.subscribe();
209-
this.generateSummary();
210-
}
211-
212206
@action
213207
handleClose() {
214208
this.modal.triggerElement = null; // prevent refocus of trigger, which changes scroll position
@@ -221,14 +215,14 @@ export default class AiSummaryModal extends Component {
221215
@closeModal={{this.handleClose}}
222216
@bodyClass="ai-summary-modal__body"
223217
class="ai-summary-modal"
224-
{{didInsert this.handleDidInsert}}
218+
{{didInsert this.subscribe @model.topic.id}}
225219
{{didUpdate this.subscribe @model.topic.id}}
226220
{{willDestroy this.unsubscribe}}
227221
@hideFooter={{not this.summarizedOn}}
228222
>
229223
<:body>
230224
{{htmlClass "scrollable-modal"}}
231-
<div class="ai-summary-container">
225+
<div class="ai-summary-container" {{didInsert this.generateSummary}}>
232226
<article
233227
class={{concatClass
234228
"ai-summary-box"
@@ -251,7 +245,7 @@ export default class AiSummaryModal extends Component {
251245
{{i18n "summary.summarized_on" date=this.summarizedOn}}
252246
<DTooltip @placements={{array "top-end"}}>
253247
<:trigger>
254-
{{dIcon "info-circle"}}
248+
{{dIcon "circle-info"}}
255249
</:trigger>
256250
<:content>
257251
{{i18n "summary.model_used" model=this.summarizedBy}}

test/javascripts/acceptance/topic-summary-test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ acceptance("Topic - Summary", function (needs) {
2222
});
2323

2424
server.get("/discourse-ai/summarization/t/1", () => {
25-
return helper.response({});
25+
return helper.response({
26+
ai_topic_summary: {
27+
summarized_text: "This a",
28+
},
29+
done: false,
30+
});
2631
});
2732
});
2833

0 commit comments

Comments
 (0)