mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Warn users of overwriting new topic draft (#8841)
This commit is contained in:
committed by
GitHub
parent
91b70f8ffc
commit
c8a02161dd
@@ -5,6 +5,7 @@ import {
|
||||
CREATE_SHARED_DRAFT,
|
||||
REPLY
|
||||
} from "discourse/models/composer";
|
||||
import Draft from "discourse/models/draft";
|
||||
import { computed } from "@ember/object";
|
||||
import { camelize } from "@ember/string";
|
||||
|
||||
@@ -223,6 +224,21 @@ export default DropdownSelectBoxComponent.extend({
|
||||
},
|
||||
|
||||
replyAsNewTopicSelected(options) {
|
||||
Draft.get("new_topic").then(response => {
|
||||
if (response.draft) {
|
||||
bootbox.confirm(
|
||||
I18n.t("composer.composer_actions.reply_as_new_topic.confirm"),
|
||||
result => {
|
||||
if (result) this._replyAsNewTopicSelect(options);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this._replyAsNewTopicSelect(options);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_replyAsNewTopicSelect(options) {
|
||||
options.action = CREATE_TOPIC;
|
||||
options.categoryId = this.get("composerModel.topic.category.id");
|
||||
options.disableScopedCategory = true;
|
||||
|
||||
Reference in New Issue
Block a user