mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Hide bootbox after a negative answer (#10028)
Starting to reply and then editing a post was not possible because of a bootbox which kept showing up.
This commit is contained in:
parent
4b793a1072
commit
60196cc192
@ -1040,7 +1040,7 @@ export default Controller.extend({
|
|||||||
const keyPrefix =
|
const keyPrefix =
|
||||||
this.model.action === "edit" ? "post.abandon_edit" : "post.abandon";
|
this.model.action === "edit" ? "post.abandon_edit" : "post.abandon";
|
||||||
|
|
||||||
let promise = new Promise(resolve => {
|
let promise = new Promise((resolve, reject) => {
|
||||||
if (this.get("model.hasMetaData") || this.get("model.replyDirty")) {
|
if (this.get("model.hasMetaData") || this.get("model.replyDirty")) {
|
||||||
bootbox.dialog(I18n.t(keyPrefix + ".confirm"), [
|
bootbox.dialog(I18n.t(keyPrefix + ".confirm"), [
|
||||||
{
|
{
|
||||||
@ -1052,8 +1052,10 @@ export default Controller.extend({
|
|||||||
if (differentDraft) {
|
if (differentDraft) {
|
||||||
this.model.clearState();
|
this.model.clearState();
|
||||||
this.close();
|
this.close();
|
||||||
|
resolve();
|
||||||
}
|
}
|
||||||
resolve();
|
|
||||||
|
reject();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -271,6 +271,24 @@ QUnit.test("Create a Reply", async assert => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test("Can edit a post after starting a reply", async assert => {
|
||||||
|
await visit("/t/internationalization-localization/280");
|
||||||
|
|
||||||
|
await click("#topic-footer-buttons .create");
|
||||||
|
await fillIn(".d-editor-input", "this is the content of my reply");
|
||||||
|
|
||||||
|
await click(".topic-post:eq(0) button.show-more-actions");
|
||||||
|
await click(".topic-post:eq(0) button.edit");
|
||||||
|
|
||||||
|
await click("a[data-handler='0']");
|
||||||
|
|
||||||
|
assert.ok(!visible(".bootbox.modal"));
|
||||||
|
assert.equal(
|
||||||
|
find(".d-editor-input").val(),
|
||||||
|
"this is the content of my reply"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test("Posting on a different topic", async assert => {
|
QUnit.test("Posting on a different topic", async assert => {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click("#topic-footer-buttons .btn.create");
|
await click("#topic-footer-buttons .btn.create");
|
||||||
|
Loading…
Reference in New Issue
Block a user