A platform for community discussion. Free, open, simple.
FIX: correctly load drafts based of id
Sam Saffronb8d2261db9f2
diff --git a/app/assets/javascripts/discourse/models/composer.js b/app/assets/javascripts/discourse/models/composer.jsindex 9d0dcb8c451..1b1fd0ace3a 100644--- a/app/assets/javascripts/discourse/models/composer.js+++ b/app/assets/javascripts/discourse/models/composer.js@@ -744,9 +744,12 @@ const Composer = RestModel.extend({if (opts.postId) {promise = promise.then(() =>- this.store- .find("post", opts.postId)- .then(post => composer.setProperties({ post }))+ this.store.find("post", opts.postId).then(post => {+ composer.set("post", post);+ if (post) {+ composer.set("topic", post.topic);+ }+ }));}@@ -765,7 +768,9 @@ const Composer = RestModel.extend({this.store.find("post", opts.post.id).then(post => {composer.setProperties({reply: post.raw,- originalText: post.raw+ originalText: post.raw,+ post: post,+ topic: post.topic});composer.appEvents.trigger("composer:reply-reloaded", composer);diff --git a/app/assets/javascripts/discourse/templates/components/composer-action-title.hbs b/app/assets/javascripts/discourse/templates/components/composer-action-title.hbsindex 3f26b6e3c5d..5d3b2eef4dd 100644--- a/app/assets/javascripts/discourse/templates/components/composer-action-title.hbs+++ b/app/assets/javascripts/discourse/templates/components/composer-action-title.hbs@@ -9,6 +9,8 @@closeComposer=closeComposeraction=model.actiontabindex=tabindex+ topic=model.topic+ post=model.post}}{{/if}}diff --git a/app/assets/javascripts/select-kit/components/composer-actions.js b/app/assets/javascripts/select-kit/components/composer-actions.jsindex 720dddd2ca1..548a0ef701d 100644--- a/app/assets/javascripts/select-kit/components/composer-actions.js+++ b/app/assets/javascripts/select-kit/components/composer-actions.js@@ -39,21 +39,17 @@ export default DropdownSelectBoxComponent.extend({// if we change topic we want to change both snapshotsif (- this.get("composerModel.topic") &&- (!_topicSnapshot ||- this.get("composerModel.topic.id") !== _topicSnapshot.id)+ this.topic &&+ (!_topicSnapshot || this.topic.id !== _topicSnapshot.id)) {- _topicSnapshot = this.get("composerModel.topic");- _postSnapshot = this.get("composerModel.post");+ _topicSnapshot = this.topic;+ _postSnapshot = this.post;this.contentChanged();}// if we hit reply on a different post we want to change postSnapshot- if (- this.get("composerModel.post") &&- (!_postSnapshot || this.get("composerModel.post.id") !== _postSnapshot.id)- ) {- _postSnapshot = this.get("composerModel.post");+ if (this.post && (!_postSnapshot || this.post.id !== _postSnapshot.id)) {+ _postSnapshot = this.post;this.contentChanged();}