From 78558b9cf5f307c38849994001356d23c1108422 Mon Sep 17 00:00:00 2001 From: Keegan George Date: Wed, 23 Aug 2023 15:12:07 -0700 Subject: [PATCH] DEV: Remove context menu timeout (#156) --- .../after-d-editor/ai-helper-context-menu.js | 8 -------- spec/system/ai_helper/ai_composer_helper_spec.rb | 16 ---------------- 2 files changed, 24 deletions(-) diff --git a/assets/javascripts/discourse/connectors/after-d-editor/ai-helper-context-menu.js b/assets/javascripts/discourse/connectors/after-d-editor/ai-helper-context-menu.js index 21fa97af..5b55b326 100644 --- a/assets/javascripts/discourse/connectors/after-d-editor/ai-helper-context-menu.js +++ b/assets/javascripts/discourse/connectors/after-d-editor/ai-helper-context-menu.js @@ -7,7 +7,6 @@ import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { createPopper } from "@popperjs/core"; import { caretPosition, getCaretPosition } from "discourse/lib/utilities"; -import discourseLater from "discourse-common/lib/later"; import { inject as service } from "@ember/service"; export default class AiHelperContextMenu extends Component { @@ -237,13 +236,6 @@ export default class AiHelperContextMenu extends Component { .finally(() => { this.loading = false; this._dEditorInput.classList.remove("loading"); - - // Make reset options disappear by closing the context menu after 5 seconds - if (this.menuState === this.CONTEXT_MENU_STATES.resets) { - discourseLater(() => { - this.closeContextMenu(); - }, 5000); - } }); } diff --git a/spec/system/ai_helper/ai_composer_helper_spec.rb b/spec/system/ai_helper/ai_composer_helper_spec.rb index 8086b04f..54f686ae 100644 --- a/spec/system/ai_helper/ai_composer_helper_spec.rb +++ b/spec/system/ai_helper/ai_composer_helper_spec.rb @@ -143,22 +143,6 @@ RSpec.describe "AI Composer helper", type: :system, js: true do expect(ai_helper_context_menu).to be_showing_resets end - it "hides reset options after 5 seconds" do - trigger_context_menu(OpenAiCompletionsInferenceStubs.spanish_text) - ai_helper_context_menu.click_ai_button - ai_helper_context_menu.select_helper_model( - OpenAiCompletionsInferenceStubs.text_mode_to_id(mode), - ) - - wait_for do - composer.composer_input.value == OpenAiCompletionsInferenceStubs.translated_response.strip - end - - expect(ai_helper_context_menu).to be_showing_resets - sleep 5 - expect(ai_helper_context_menu).to be_not_showing_resets - end - it "reverts results when Undo button is clicked" do trigger_context_menu(OpenAiCompletionsInferenceStubs.spanish_text) ai_helper_context_menu.click_ai_button