From 79c673e8fbd67db6f49dd05ae6285b9c30cfdc19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Saquetim?= Date: Wed, 26 Mar 2025 21:48:26 -0300 Subject: [PATCH 1/2] DEV: Remove the legacy widget post menu code --- .../post-menu/ai-cancel-streaming-button.gjs | 11 +- .../components/post-menu/ai-debug-button.gjs | 7 +- .../components/post-menu/ai-share-button.gjs | 23 +-- .../initializers/ai-bot-replies.js | 94 +---------- spec/system/ai_bot/share_spec.rb | 156 +++++++++--------- 5 files changed, 90 insertions(+), 201 deletions(-) diff --git a/assets/javascripts/discourse/components/post-menu/ai-cancel-streaming-button.gjs b/assets/javascripts/discourse/components/post-menu/ai-cancel-streaming-button.gjs index aa3cef2c0..3fa2170e8 100644 --- a/assets/javascripts/discourse/components/post-menu/ai-cancel-streaming-button.gjs +++ b/assets/javascripts/discourse/components/post-menu/ai-cancel-streaming-button.gjs @@ -5,8 +5,10 @@ import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; export default class AiCancelStreamingButton extends Component { - // TODO (glimmer-post-menu): Remove this static function and move the code into the button action after the widget code is removed - static async cancelStreaming(post) { + @action + async cancelStreaming() { + const post = this.args.post; + try { await ajax(`/discourse-ai/ai-bot/post/${post.id}/stop-streaming`, { type: "POST", @@ -20,11 +22,6 @@ export default class AiCancelStreamingButton extends Component { } } - @action - cancelStreaming() { - this.constructor.cancelStreaming(this.args.post); - } -