A platform for community discussion. Free, open, simple.
FIX: display error when moving post fails (#23860)
Krzysztof Kotlarekbb342bafe9a9
diff --git a/app/assets/javascripts/discourse/app/components/modal/move-to-topic.hbs b/app/assets/javascripts/discourse/app/components/modal/move-to-topic.hbsindex b08bc15fb22..1c37295002d 100644--- a/app/assets/javascripts/discourse/app/components/modal/move-to-topic.hbs+++ b/app/assets/javascripts/discourse/app/components/modal/move-to-topic.hbs@@ -3,6 +3,8 @@@title={{i18n "topic.move_to.title"}}@closeModal={{@closeModal}}class="choose-topic-modal"+ @flash={{this.flash}}+ @flashType="error"><:body>{{#if @model.topic.isPrivateMessage}}diff --git a/app/assets/javascripts/discourse/app/components/modal/move-to-topic.js b/app/assets/javascripts/discourse/app/components/modal/move-to-topic.jsindex 84c17e03d01..955b064b708 100644--- a/app/assets/javascripts/discourse/app/components/modal/move-to-topic.js+++ b/app/assets/javascripts/discourse/app/components/modal/move-to-topic.js@@ -19,6 +19,7 @@ export default class MoveToTopic extends Component {@tracked chronologicalOrder = false;@tracked selection = "new_topic";@tracked selectedTopicId;+ @tracked flash;constructor() {super(...arguments);diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.jsindex 5ee88179af7..eac343763ab 100644--- a/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js@@ -9,6 +9,13 @@ import { test } from "qunit";acceptance("Topic move posts", function (needs) {needs.user();+ needs.pretender((server, helper) => {+ server.post("/t/280/move-posts", () => {+ return helper.response(404, {+ errors: ["Invalid title"],+ });+ });+ });test("default", async function (assert) {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) {await visit("/t/internationalization-localization");await click(".toggle-admin-menu");