Skip to content

A platform for community discussion. Free, open, simple.

DEV: Drop legacy modal controller deprecation (#38758)

David Taylor49504a2c1358
diff --git a/frontend/discourse/app/deprecation-workflow.js b/frontend/discourse/app/deprecation-workflow.js
index 126439b591f..9f8c1be38f0 100644
--- a/frontend/discourse/app/deprecation-workflow.js
+++ b/frontend/discourse/app/deprecation-workflow.js
@@ -360,7 +360,6 @@ const workflows = [
},
{ handler: "notify-admin", matchId: "discourse.jquery-cookie" },
{ handler: "notify-admin", matchId: "discourse.markdown-it.whitelist" },
- { handler: "notify-admin", matchId: "discourse.modal-controllers" },
{ handler: "notify-admin", matchId: "discourse.models-store" },
{
handler: "notify-admin",
diff --git a/frontend/discourse/app/lib/show-modal.js b/frontend/discourse/app/lib/show-modal.js
deleted file mode 100644
index ac0d75a7298..00000000000
--- a/frontend/discourse/app/lib/show-modal.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// Remove when legacy modals are dropped (deprecation: discourse.modal-controllers)
-
-import { getOwnerWithFallback } from "discourse/lib/get-owner";
-
-/**
- * Render a modal
- *
- * @param {string} name - the controller/template name for the modal body.
- *
- * @param {Object} [options] - options
- * @param {string} [options.model] - An object which will be set as the `model` property on the controller
- * @param {boolean} [options.admin] - look under the admin namespace for the controller/template
- * @param {string} [options.templateName] - override the template name to render
- * @param {string} [options.title] - (deprecated) translation key for modal title. Pass `@title` to DModalBody instead
- * @param {string} [options.titleTranslated] - (deprecated) translated modal title. Pass `@rawTitle` to DModalBody instead
- * @param {string} [options.modalClass] - (deprecated) classname for modal. Pass `@modalClass` to DModalBody instead
- * @param {string} [options.titleAriaElementId] - (deprecated) Pass `@titleAriaElementId` to DModalBody instead
- *
- * @returns {Controller} The modal controller instance
- */
-export default function showModal(name, opts) {
- if (typeof name !== "string") {
- throw new Error(
- "`discourse/lib/show-modal` can only be used with the legacy controller-based API. To use the new component-based API, inject the modal service and call modal.show(). https://meta.discourse.org/t/268057"
- );
- }
- opts = opts || {};
-
- let container = getOwnerWithFallback(this);
- if (container.isDestroying || container.isDestroyed) {
- return;
- }
-
- const modalService = container.lookup("service:modal");
- return modalService.show(name, opts);
-}
diff --git a/frontend/discourse/app/services/modal.js b/frontend/discourse/app/services/modal.js
index a845c5f964f..8b4fb83dc90 100644
--- a/frontend/discourse/app/services/modal.js
+++ b/frontend/discourse/app/services/modal.js
@@ -2,7 +2,6 @@ import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import Service, { service } from "@ember/service";
import { CLOSE_INITIATED_BY_MODAL_SHOW } from "discourse/components/d-modal";
-import deprecated from "discourse/lib/deprecated";
import { disableImplicitInjections } from "discourse/lib/implicit-injections";
import { waitForClosedKeyboard } from "discourse/lib/wait-for-keyboard";
@@ -18,7 +17,6 @@ const LEGACY_OPTS = new Set([
@disableImplicitInjections
export default class ModalService extends Service {
- @service dialog;
@service site;
@service capabilities;
@@ -44,22 +42,6 @@ export default class ModalService extends Service {
* @returns {Promise} A promise that resolves when the modal is closed, with any data passed to closeModal
*/
async show(modal, opts) {
- if (typeof modal === "string") {
- this.dialog.alert(
- `Error: the '${modal}' modal needs updating to work with the latest version of Discourse. See https://meta.discourse.org/t/268057.`
- );
- deprecated(
- `Defining modals using a controller is no longer supported. Use the component-based API instead. (modal: ${modal})`,
- {
- id: "discourse.modal-controllers",
- since: "3.1",
- url: "https://meta.discourse.org/t/268057",
- raiseError: true,
- }
- );
- return;
- }
-
const trigger = document.activeElement;
this.close({ initiatedBy: CLOSE_INITIATED_BY_MODAL_SHOW });