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
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,20 @@ export default class AiComposerHelperMenu extends Component {
}

@action
suggestChanges(option) {
async suggestChanges(option) {
await this.args.close();

if (option.name === "illustrate_post") {
this.modal.show(ThumbnailSuggestion, {
return this.modal.show(ThumbnailSuggestion, {
model: {
mode: option.id,
selectedText: this.args.data.selectedText,
thumbnails: this.thumbnailSuggestions,
},
});
return this.args.close();
}

this.modal.show(ModalDiffModal, {
return this.modal.show(ModalDiffModal, {
model: {
mode: option.id,
selectedText: this.args.data.selectedText,
Expand All @@ -130,7 +131,6 @@ export default class AiComposerHelperMenu extends Component {
customPromptValue: this.customPromptValue,
},
});
return this.args.close();
}

@action
Expand Down
15 changes: 15 additions & 0 deletions spec/system/ai_helper/ai_composer_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,19 @@ def trigger_composer_helper(content)
expect(page).to have_no_css(".d-editor-button-bar button.ai-helper-trigger")
end
end

context "when triggering composer AI helper", mobile: true do
it "should close the composer helper before showing the diff modal" do
visit("/latest")
page.find("#create-topic").click
composer.fill_content(input)
composer.click_toolbar_button("ai-helper-trigger")

DiscourseAi::Completions::Llm.with_prepared_responses([input]) do
ai_helper_menu.select_helper_model(CompletionPrompt::TRANSLATE)
expect(ai_helper_menu).to have_no_context_menu
expect(diff_modal).to be_visible
end
end
end
end