From de6070fac4c9a32c275e62554d5a2a4c9ad977f8 Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Thu, 27 Jul 2023 15:08:37 -0500 Subject: [PATCH] DEV: Convert `delete-topic-disallowed` modal to component-based API (#22830) --- .../app/components/modal/delete-topic-disallowed.hbs | 8 ++++++++ app/assets/javascripts/discourse/app/services/modal.js | 1 - .../app/templates/modal/delete-topic-disallowed.hbs | 10 ---------- .../javascripts/discourse/app/widgets/post-menu.js | 5 +++-- 4 files changed, 11 insertions(+), 13 deletions(-) create mode 100644 app/assets/javascripts/discourse/app/components/modal/delete-topic-disallowed.hbs delete mode 100644 app/assets/javascripts/discourse/app/templates/modal/delete-topic-disallowed.hbs diff --git a/app/assets/javascripts/discourse/app/components/modal/delete-topic-disallowed.hbs b/app/assets/javascripts/discourse/app/components/modal/delete-topic-disallowed.hbs new file mode 100644 index 00000000000..7d469645167 --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/modal/delete-topic-disallowed.hbs @@ -0,0 +1,8 @@ + + <:body> +

{{html-safe (i18n "post.controls.delete_topic_disallowed_modal")}}

+ + <:footer> + + +
\ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/services/modal.js b/app/assets/javascripts/discourse/app/services/modal.js index 44e9fee420d..d84030ad5d4 100644 --- a/app/assets/javascripts/discourse/app/services/modal.js +++ b/app/assets/javascripts/discourse/app/services/modal.js @@ -24,7 +24,6 @@ const KNOWN_LEGACY_MODALS = [ "create-account", "create-invite-bulk", "create-invite", - "delete-topic-disallowed", "download-calendar", "edit-slow-mode", "edit-topic-timer", diff --git a/app/assets/javascripts/discourse/app/templates/modal/delete-topic-disallowed.hbs b/app/assets/javascripts/discourse/app/templates/modal/delete-topic-disallowed.hbs deleted file mode 100644 index e207bbaf8fa..00000000000 --- a/app/assets/javascripts/discourse/app/templates/modal/delete-topic-disallowed.hbs +++ /dev/null @@ -1,10 +0,0 @@ - -

{{html-safe (i18n "post.controls.delete_topic_disallowed_modal")}}

-
- \ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/widgets/post-menu.js b/app/assets/javascripts/discourse/app/widgets/post-menu.js index e4bdb469f26..48d2da21cae 100644 --- a/app/assets/javascripts/discourse/app/widgets/post-menu.js +++ b/app/assets/javascripts/discourse/app/widgets/post-menu.js @@ -4,7 +4,6 @@ import discourseLater from "discourse-common/lib/later"; import { Promise } from "rsvp"; import { formattedReminderTime } from "discourse/lib/bookmark"; import { h } from "virtual-dom"; -import showModal from "discourse/lib/show-modal"; import { smallUserAtts } from "discourse/widgets/actions-summary"; import I18n from "I18n"; import { @@ -12,6 +11,7 @@ import { WITH_REMINDER_ICON, } from "discourse/models/bookmark"; import { isTesting } from "discourse-common/config/environment"; +import DeleteTopicDisallowedModal from "discourse/components/modal/delete-topic-disallowed"; const LIKE_ACTION = 2; const VIBRATE_DURATION = 5; @@ -447,6 +447,7 @@ function replaceButton(buttons, find, replace) { export default createWidget("post-menu", { tagName: "section.post-menu-area.clearfix", + services: ["modal"], settings: { collapseButtons: true, @@ -712,7 +713,7 @@ export default createWidget("post-menu", { }, showDeleteTopicModal() { - showModal("delete-topic-disallowed"); + this.modal.show(DeleteTopicDisallowedModal); }, showMoreActions() {