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 +27
-6
lines changed
assets/javascripts/discourse/components Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -278,12 +278,10 @@ export default class AiPostHelperMenu extends Component {
278278
279279 @action
280280 closeMenu () {
281- if (this .site .mobileView ) {
282- return this .args .close ();
283- }
284-
285- const menu = this .menu .getByIdentifier (" post-text-selection-toolbar" );
286- return menu? .close ();
281+ // reset state and close
282+ this .suggestion = " " ;
283+ this .customPromptValue = " " ;
284+ return this .args .close ();
287285 }
288286
289287 @action
Original file line number Diff line number Diff line change @@ -110,6 +110,29 @@ def select_post_text(selected_post)
110110 expect ( post_ai_helper ) . to have_suggestion_value ( explain_response )
111111 end
112112 end
113+
114+ context "with footnotes enabled" do
115+ before do
116+ SiteSetting . enable_markdown_footnotes = true
117+ SiteSetting . display_footnotes_inline = true
118+ end
119+
120+ it "allows adding the explanation as a footnote to the post" do
121+ select_post_text ( post )
122+ post_ai_helper . click_ai_button
123+
124+ DiscourseAi ::Completions ::Llm . with_prepared_responses ( [ explain_response ] ) do
125+ post_ai_helper . select_helper_model ( mode )
126+ expect ( post_ai_helper ) . to have_suggestion_value ( explain_response )
127+ post_ai_helper . click_add_footnote
128+ wait_for { post_ai_helper . has_no_post_ai_helper? }
129+ post . reload
130+ expect ( post . raw ) . to include (
131+ "^[#{ explain_response } (#{ I18n . t ( "js.discourse_ai.ai_helper.post_options_menu.footnote_credits" ) } )]" ,
132+ )
133+ end
134+ end
135+ end
113136 end
114137 end
115138
You can’t perform that action at this time.
0 commit comments