mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: display error when moving post fails (#23860)
This fix ensures that an error modal is displayed when a post is moved to a new topic that has an invalid title.
This commit is contained in:
parent
b58f660cd2
commit
bb342bafe9
@ -3,6 +3,8 @@
|
|||||||
@title={{i18n "topic.move_to.title"}}
|
@title={{i18n "topic.move_to.title"}}
|
||||||
@closeModal={{@closeModal}}
|
@closeModal={{@closeModal}}
|
||||||
class="choose-topic-modal"
|
class="choose-topic-modal"
|
||||||
|
@flash={{this.flash}}
|
||||||
|
@flashType="error"
|
||||||
>
|
>
|
||||||
<:body>
|
<:body>
|
||||||
{{#if @model.topic.isPrivateMessage}}
|
{{#if @model.topic.isPrivateMessage}}
|
||||||
|
@ -19,6 +19,7 @@ export default class MoveToTopic extends Component {
|
|||||||
@tracked chronologicalOrder = false;
|
@tracked chronologicalOrder = false;
|
||||||
@tracked selection = "new_topic";
|
@tracked selection = "new_topic";
|
||||||
@tracked selectedTopicId;
|
@tracked selectedTopicId;
|
||||||
|
@tracked flash;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
|
@ -9,6 +9,13 @@ import { test } from "qunit";
|
|||||||
|
|
||||||
acceptance("Topic move posts", function (needs) {
|
acceptance("Topic move posts", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
|
needs.pretender((server, helper) => {
|
||||||
|
server.post("/t/280/move-posts", () => {
|
||||||
|
return helper.response(404, {
|
||||||
|
errors: ["Invalid title"],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test("default", async function (assert) {
|
test("default", async function (assert) {
|
||||||
await visit("/t/internationalization-localization");
|
await visit("/t/internationalization-localization");
|
||||||
@ -53,6 +60,20 @@ acceptance("Topic move posts", function (needs) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("display error when new topic has invalid title", async function (assert) {
|
||||||
|
await visit("/t/internationalization-localization");
|
||||||
|
await click(".toggle-admin-menu");
|
||||||
|
await click(".topic-admin-multi-select .btn");
|
||||||
|
await click("#post_11 .select-below");
|
||||||
|
await click(".selected-posts .move-to-topic");
|
||||||
|
await fillIn(".choose-topic-modal #split-topic-name", "Existing topic");
|
||||||
|
await click(".choose-topic-modal .modal-footer .btn-primary");
|
||||||
|
assert.strictEqual(
|
||||||
|
query("#modal-alert").innerText.trim(),
|
||||||
|
I18n.t("topic.move_to.error")
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("moving all posts", async function (assert) {
|
test("moving all posts", async function (assert) {
|
||||||
await visit("/t/internationalization-localization");
|
await visit("/t/internationalization-localization");
|
||||||
await click(".toggle-admin-menu");
|
await click(".toggle-admin-menu");
|
||||||
|
Loading…
Reference in New Issue
Block a user