From aa5c968b18e83d58e200c3b1c98c502d01f91b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Saquetim?= <1108771+megothss@users.noreply.github.com> Date: Wed, 2 Apr 2025 18:32:31 -0300 Subject: [PATCH] DEV: Remove the legacy widget post menu code (#1225) --- .../post-menu/ai-cancel-streaming-button.gjs | 11 +- .../components/post-menu/ai-debug-button.gjs | 7 +- .../components/post-menu/ai-share-button.gjs | 25 ++--- .../initializers/ai-bot-replies.js | 100 +----------------- 4 files changed, 18 insertions(+), 125 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 aa3cef2c..3fa2170e 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); - } -