mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 01:54:41 +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
|
// or get a draft sequence number
|
||||||
if (!opts.draft || opts.draftSequence === undefined) {
|
if (!opts.draft || opts.draftSequence === undefined) {
|
||||||
return Draft.get(opts.draftKey)
|
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 => {
|
.then(data => {
|
||||||
opts.draft = opts.draft || data.draft;
|
opts.draft = opts.draft || data.draft;
|
||||||
|
|
||||||
|
@ -298,6 +298,7 @@ export default DropdownSelectBoxComponent.extend({
|
|||||||
options.action = action;
|
options.action = action;
|
||||||
options.categoryId = this.get("composerModel.categoryId");
|
options.categoryId = this.get("composerModel.categoryId");
|
||||||
options.topicTitle = this.get("composerModel.title");
|
options.topicTitle = this.get("composerModel.title");
|
||||||
|
options.skipDraftCheck = true;
|
||||||
this._openComposer(options);
|
this._openComposer(options);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers";
|
import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers";
|
||||||
import { _clearSnapshots } from "select-kit/components/composer-actions";
|
import { _clearSnapshots } from "select-kit/components/composer-actions";
|
||||||
|
import { toggleCheckDraftPopup } from "discourse/controllers/composer";
|
||||||
|
|
||||||
acceptance("Composer Actions", {
|
acceptance("Composer Actions", {
|
||||||
loggedIn: true,
|
loggedIn: true,
|
||||||
@ -125,11 +126,16 @@ QUnit.test("replying to post - reply_as_new_topic", async assert => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("shared draft", async assert => {
|
QUnit.test("shared draft", async assert => {
|
||||||
|
toggleCheckDraftPopup(true);
|
||||||
|
|
||||||
const composerActions = selectKit(".composer-actions");
|
const composerActions = selectKit(".composer-actions");
|
||||||
|
|
||||||
await visit("/");
|
await visit("/");
|
||||||
await click("#create-topic");
|
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.expand();
|
||||||
await composerActions.selectRowByValue("shared_draft");
|
await composerActions.selectRowByValue("shared_draft");
|
||||||
|
|
||||||
@ -138,6 +144,8 @@ QUnit.test("shared draft", async assert => {
|
|||||||
I18n.t("composer.create_shared_draft")
|
I18n.t("composer.create_shared_draft")
|
||||||
);
|
);
|
||||||
assert.ok(find("#reply-control.composing-shared-draft").length === 1);
|
assert.ok(find("#reply-control.composing-shared-draft").length === 1);
|
||||||
|
|
||||||
|
toggleCheckDraftPopup(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test("hide component if no content", async assert => {
|
QUnit.test("hide component if no content", async assert => {
|
||||||
|
Reference in New Issue
Block a user