mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 11:17:52 +08:00
FIX: Bypass draft check when switching to shared draft. (#6782)
This commit is contained in:

committed by
Régis Hanol

parent
0ce5f05b2a
commit
7050ce4638
@ -786,7 +786,14 @@ export default Ember.Controller.extend({
|
||||
// or get a draft sequence number
|
||||
if (!opts.draft || opts.draftSequence === undefined) {
|
||||
return Draft.get(opts.draftKey)
|
||||
.then(data => self.confirmDraftAbandon(data))
|
||||
.then(data => {
|
||||
if (opts.skipDraftCheck) {
|
||||
data.draft = undefined;
|
||||
return data;
|
||||
}
|
||||
|
||||
return self.confirmDraftAbandon(data);
|
||||
})
|
||||
.then(data => {
|
||||
opts.draft = opts.draft || data.draft;
|
||||
|
||||
|
@ -298,6 +298,7 @@ export default DropdownSelectBoxComponent.extend({
|
||||
options.action = action;
|
||||
options.categoryId = this.get("composerModel.categoryId");
|
||||
options.topicTitle = this.get("composerModel.title");
|
||||
options.skipDraftCheck = true;
|
||||
this._openComposer(options);
|
||||
},
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers";
|
||||
import { _clearSnapshots } from "select-kit/components/composer-actions";
|
||||
import { toggleCheckDraftPopup } from "discourse/controllers/composer";
|
||||
|
||||
acceptance("Composer Actions", {
|
||||
loggedIn: true,
|
||||
@ -125,11 +126,16 @@ QUnit.test("replying to post - reply_as_new_topic", async assert => {
|
||||
});
|
||||
|
||||
QUnit.test("shared draft", async assert => {
|
||||
toggleCheckDraftPopup(true);
|
||||
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
await fillIn("#reply-title", "This is the new text for the title");
|
||||
await fillIn(".d-editor-input", "This is the new text for the post");
|
||||
|
||||
await composerActions.expand();
|
||||
await composerActions.selectRowByValue("shared_draft");
|
||||
|
||||
@ -138,6 +144,8 @@ QUnit.test("shared draft", async assert => {
|
||||
I18n.t("composer.create_shared_draft")
|
||||
);
|
||||
assert.ok(find("#reply-control.composing-shared-draft").length === 1);
|
||||
|
||||
toggleCheckDraftPopup(false);
|
||||
});
|
||||
|
||||
QUnit.test("hide component if no content", async assert => {
|
||||
|
Reference in New Issue
Block a user