diff --git a/app/assets/javascripts/discourse/app/controllers/delete-topic-confirm.js b/app/assets/javascripts/discourse/app/controllers/delete-topic-confirm.js index eb5496e89a7..423999c3c0f 100644 --- a/app/assets/javascripts/discourse/app/controllers/delete-topic-confirm.js +++ b/app/assets/javascripts/discourse/app/controllers/delete-topic-confirm.js @@ -1,4 +1,4 @@ -import Controller, { inject as controller } from "@ember/controller"; +import Controller from "@ember/controller"; import I18n from "I18n"; import ModalFunctionality from "discourse/mixins/modal-functionality"; import { action } from "@ember/object"; @@ -7,7 +7,6 @@ import discourseComputed from "discourse-common/utils/decorators"; // Modal that displays confirmation text when user deletes a topic // The modal will display only if the topic exceeds a certain amount of views export default Controller.extend(ModalFunctionality, { - topicController: controller("topic"), deletingTopic: false, @discourseComputed("deletingTopic") @@ -25,7 +24,7 @@ export default Controller.extend(ModalFunctionality, { deleteTopic() { this.set("deletingTopic", true); - this.topicController.model + this.model .destroy(this.currentUser) .then(() => this.send("closeModal")) .catch(() => { diff --git a/app/assets/javascripts/discourse/app/models/topic.js b/app/assets/javascripts/discourse/app/models/topic.js index 700037c827d..39521f4f18a 100644 --- a/app/assets/javascripts/discourse/app/models/topic.js +++ b/app/assets/javascripts/discourse/app/models/topic.js @@ -453,7 +453,7 @@ const Topic = RestModel.extend({ }, // Delete this topic - destroy(deleted_by, opts) { + destroy(deleted_by, opts = {}) { return ajax(`/t/${this.id}`, { data: { context: window.location.pathname, ...opts }, type: "DELETE",