Skip to content

A platform for community discussion. Free, open, simple.

FIX: Move posts modal passing topic instance rather than ID (#30622)

Mark VanLandingham260017de1d66
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.hbs
index 607827a9766..90e1c3886bd 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
@@ -70,7 +70,7 @@
<form>
<ChooseMessage
@currentTopicId={{@model.topic.id}}
- @setSelectedTopicId={{fn (mut this.selectedTopicId)}}
+ @setSelectedTopicId={{fn (mut this.selectedTopic)}}
/>
<label>{{i18n "topic.move_to_new_message.participants"}}</label>
@@ -80,7 +80,7 @@
@onChange={{fn (mut this.participants)}}
/>
- {{#if this.selectedTopicId}}
+ {{#if this.selectedTopic}}
<hr />
<label for="chronological-order" class="checkbox-label">
<Input
@@ -147,7 +147,7 @@
@currentTopicId={{@model.topic.id}}
/>
- {{#if this.selectedTopicId}}
+ {{#if this.selectedTopic}}
<hr />
<label for="chronological-order" class="checkbox-label">
<Input
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.js
index 5cea8e3fd06..8f059a9dfcf 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,7 +19,7 @@ export default class MoveToTopic extends Component {
@tracked participants = [];
@tracked chronologicalOrder = false;
@tracked selection = "new_topic";
- @tracked selectedTopicId;
+ @tracked selectedTopic;
@tracked flash;
constructor() {
@@ -49,7 +49,7 @@ export default class MoveToTopic extends Component {
get buttonDisabled() {
return (
- this.saving || (isEmpty(this.selectedTopicId) && isEmpty(this.topicName))
+ this.saving || (isEmpty(this.selectedTopic) && isEmpty(this.topicName))
);
}
@@ -110,7 +110,7 @@ export default class MoveToTopic extends Component {
if (type === "existingTopic") {
mergeOptions = {
- destination_topic_id: this.selectedTopicId,
+ destination_topic_id: this.selectedTopic.id,
chronological_order: this.chronologicalOrder,
};
moveOptions = {
@@ -119,7 +119,7 @@ export default class MoveToTopic extends Component {
};
} else if (type === "existingMessage") {
mergeOptions = {
- destination_topic_id: this.selectedTopicId,
+ destination_topic_id: this.selectedTopic.id,
participants: this.participants.join(","),
archetype: "private_message",
chronological_order: this.chronologicalOrder,
@@ -190,6 +190,6 @@ export default class MoveToTopic extends Component {
@action
newTopicSelected(topic) {
- this.selectedTopicId = topic.id;
+ this.selectedTopic = topic;
}
}