mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
parent
debed81022
commit
a098464af3
@ -769,11 +769,23 @@ const Composer = RestModel.extend({
|
|||||||
composer.setProperties({
|
composer.setProperties({
|
||||||
reply: post.raw,
|
reply: post.raw,
|
||||||
originalText: post.raw,
|
originalText: post.raw,
|
||||||
post: post,
|
post: post
|
||||||
topic: post.topic
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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);
|
composer.appEvents.trigger("composer:reply-reloaded", composer);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else if (opts.action === REPLY && opts.quote) {
|
} else if (opts.action === REPLY && opts.quote) {
|
||||||
|
Loading…
Reference in New Issue
Block a user