mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 04:18:23 +00:00
FIX: Retain tags when loading a topic draft in composer (#12616)
This commit is contained in:
parent
769b3ba8ae
commit
cdb99f012b
@ -78,6 +78,7 @@ const CLOSED = "closed",
|
|||||||
action: "action",
|
action: "action",
|
||||||
title: "title",
|
title: "title",
|
||||||
categoryId: "categoryId",
|
categoryId: "categoryId",
|
||||||
|
tags: "tags",
|
||||||
archetypeId: "archetypeId",
|
archetypeId: "archetypeId",
|
||||||
whisper: "whisper",
|
whisper: "whisper",
|
||||||
metaData: "metaData",
|
metaData: "metaData",
|
||||||
|
@ -3,12 +3,14 @@ import {
|
|||||||
exists,
|
exists,
|
||||||
invisible,
|
invisible,
|
||||||
queryAll,
|
queryAll,
|
||||||
|
updateCurrentUser,
|
||||||
visible,
|
visible,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||||
import { skip, test } from "qunit";
|
import { skip, test } from "qunit";
|
||||||
import Draft from "discourse/models/draft";
|
import Draft from "discourse/models/draft";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import { NEW_TOPIC_KEY } from "discourse/models/composer";
|
||||||
import { Promise } from "rsvp";
|
import { Promise } from "rsvp";
|
||||||
import { run } from "@ember/runloop";
|
import { run } from "@ember/runloop";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
@ -19,6 +21,7 @@ import LinkLookup from "discourse/lib/link-lookup";
|
|||||||
acceptance("Composer", function (needs) {
|
acceptance("Composer", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
needs.settings({ enable_whispers: true });
|
needs.settings({ enable_whispers: true });
|
||||||
|
needs.site({ can_tag_topics: true });
|
||||||
needs.pretender((server, helper) => {
|
needs.pretender((server, helper) => {
|
||||||
server.post("/uploads/lookup-urls", () => {
|
server.post("/uploads/lookup-urls", () => {
|
||||||
return helper.response([]);
|
return helper.response([]);
|
||||||
@ -780,6 +783,29 @@ acceptance("Composer", function (needs) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Loads tags and category from draft payload", async function (assert) {
|
||||||
|
updateCurrentUser({ has_topic_draft: true });
|
||||||
|
|
||||||
|
sinon.stub(Draft, "get").returns(
|
||||||
|
Promise.resolve({
|
||||||
|
draft:
|
||||||
|
'{"reply":"Hey there","action":"createTopic","title":"Draft topic","categoryId":2,"tags":["fun", "times"],"archetypeId":"regular","metaData":null,"composerTime":25269,"typingTime":8100}',
|
||||||
|
draft_sequence: 0,
|
||||||
|
draft_key: NEW_TOPIC_KEY,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await visit("/latest");
|
||||||
|
assert.equal(
|
||||||
|
queryAll("#create-topic").text().trim(),
|
||||||
|
I18n.t("topic.open_draft")
|
||||||
|
);
|
||||||
|
|
||||||
|
await click("#create-topic");
|
||||||
|
assert.equal(selectKit(".category-chooser").header().value(), "2");
|
||||||
|
assert.equal(selectKit(".mini-tag-chooser").header().value(), "fun,times");
|
||||||
|
});
|
||||||
|
|
||||||
test("Deleting the text content of the first post in a private message", async function (assert) {
|
test("Deleting the text content of the first post in a private message", async function (assert) {
|
||||||
await visit("/t/34");
|
await visit("/t/34");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user