diff --git a/app/assets/javascripts/admin/addon/routes/admin-backups.js b/app/assets/javascripts/admin/addon/routes/admin-backups.js index 1379a097544..106dc821112 100644 --- a/app/assets/javascripts/admin/addon/routes/admin-backups.js +++ b/app/assets/javascripts/admin/addon/routes/admin-backups.js @@ -67,7 +67,6 @@ export default DiscourseRoute.extend({ actions: { showStartBackupModal() { showModal("admin-start-backup", { admin: true }); - this.controllerFor("modal").set("modalClass", "start-backup-modal"); }, startBackup(withUploads) { diff --git a/app/assets/javascripts/discourse/app/controllers/login.js b/app/assets/javascripts/discourse/app/controllers/login.js index 9d35dc7c977..c4038cc086b 100644 --- a/app/assets/javascripts/discourse/app/controllers/login.js +++ b/app/assets/javascripts/discourse/app/controllers/login.js @@ -437,10 +437,9 @@ export default Controller.extend(ModalFunctionality, { return; } - const skipConfirmation = - options && this.siteSettings.auth_skip_create_confirm; - + const skipConfirmation = this.siteSettings.auth_skip_create_confirm; const createAccountController = this.createAccount; + createAccountController.setProperties({ accountEmail: options.email, accountUsername: options.username, @@ -450,7 +449,7 @@ export default Controller.extend(ModalFunctionality, { }); next(() => { - showModal("createAccount", { + showModal("create-account", { modalClass: "create-account", titleAriaElementId: "create-account-title", }); diff --git a/app/assets/javascripts/discourse/app/routes/application.js b/app/assets/javascripts/discourse/app/routes/application.js index 9a9f08e9ef3..e3b54b895a6 100644 --- a/app/assets/javascripts/discourse/app/routes/application.js +++ b/app/assets/javascripts/discourse/app/routes/application.js @@ -139,7 +139,7 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, { offerHelp: null, helpSeen: false, }); - showModal("forgotPassword", { title: "forgot_password.title" }); + showModal("forgot-password", { title: "forgot_password.title" }); }, showNotActivated(props) { @@ -266,7 +266,7 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, { const returnPath = encodeURIComponent(window.location.pathname); window.location = getURL("/session/sso?return_path=" + returnPath); } else { - this._autoLogin("login", "login-modal", { + this._autoLogin("login", { notAuto: () => this.controllerFor("login").resetForm(), }); } @@ -277,7 +277,8 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, { const returnPath = encodeURIComponent(window.location.pathname); window.location = getURL("/session/sso?return_path=" + returnPath); } else { - this._autoLogin("createAccount", "create-account", { + this._autoLogin("create-account", { + modalClass: "create-account", signup: true, titleAriaElementId: "create-account-title", }); @@ -286,8 +287,12 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, { _autoLogin( modal, - modalClass, - { notAuto = null, signup = false, titleAriaElementId = null } = {} + { + modalClass = undefined, + notAuto = null, + signup = false, + titleAriaElementId = null, + } = {} ) { const methods = findAll(); @@ -296,11 +301,8 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, { signup, }); } else { - showModal(modal, { titleAriaElementId }); - this.controllerFor("modal").set("modalClass", modalClass); - if (notAuto) { - notAuto(); - } + showModal(modal, { modalClass, titleAriaElementId }); + notAuto?.(); } }, diff --git a/app/assets/javascripts/discourse/app/routes/discovery-categories.js b/app/assets/javascripts/discourse/app/routes/discovery-categories.js index 1bbb16c2cba..5644650a5cb 100644 --- a/app/assets/javascripts/discourse/app/routes/discovery-categories.js +++ b/app/assets/javascripts/discourse/app/routes/discovery-categories.js @@ -150,7 +150,7 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, { @action reorderCategories() { - showModal("reorderCategories"); + showModal("reorder-categories"); }, @action diff --git a/app/assets/javascripts/discourse/app/routes/topic.js b/app/assets/javascripts/discourse/app/routes/topic.js index 2f4570b181b..9c237a04164 100644 --- a/app/assets/javascripts/discourse/app/routes/topic.js +++ b/app/assets/javascripts/discourse/app/routes/topic.js @@ -113,13 +113,11 @@ const TopicRoute = DiscourseRoute.extend({ showTopicTimerModal() { const model = this.modelFor("topic"); - const topicTimer = model.get("topic_timer"); - if (!topicTimer) { + if (!model.get("topic_timer")) { model.set("topic_timer", {}); } showModal("edit-topic-timer", { model }); - this.controllerFor("modal").set("modalClass", "edit-topic-timer-modal"); }, @action @@ -139,11 +137,10 @@ const TopicRoute = DiscourseRoute.extend({ @action showFeatureTopic() { - showModal("featureTopic", { + showModal("feature-topic", { model: this.modelFor("topic"), title: "topic.feature_topic.title", }); - this.controllerFor("modal").set("modalClass", "feature-topic-modal"); this.controllerFor("feature_topic").reset(); },