FIX: ninja edit for replies not working

There is an edge case, in some cases when pulling a post from the store
there is no topic, this ensures it is loaded correctly.
This commit is contained in:
Sam Saffron 2020-04-01 16:40:55 +11:00
parent debed81022
commit a098464af3
No known key found for this signature in database
GPG Key ID: B9606168D2FFD9F5

View File

@ -769,11 +769,23 @@ const Composer = RestModel.extend({
composer.setProperties({
reply: post.raw,
originalText: post.raw,
post: post,
topic: post.topic
post: post
});
composer.appEvents.trigger("composer:reply-reloaded", composer);
promise = Promise.resolve();
// edge case ... make a post then edit right away
// store does not have topic for the post
if (composer.topic && composer.topic.id === post.topic_id) {
// nothing to do ... we have the right topic
} else {
promise = this.store.find("topic", post.topic_id).then(topic => {
this.set("topic", topic);
});
}
return promise.then(() => {
composer.appEvents.trigger("composer:reply-reloaded", composer);
});
})
);
} else if (opts.action === REPLY && opts.quote) {