mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: Cancel and reopen composer when editing first post.
This commit is contained in:
parent
28f0a012ca
commit
a966546843
1 changed files with 15 additions and 6 deletions
|
@ -207,12 +207,21 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||||
return bootbox.alert(I18n.t('post.controls.edit_anonymous'));
|
return bootbox.alert(I18n.t('post.controls.edit_anonymous'));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.get('controllers.composer').open({
|
const composer = this.get('controllers.composer'),
|
||||||
|
composerModel = composer.get('model'),
|
||||||
|
opts = {
|
||||||
post: post,
|
post: post,
|
||||||
action: Discourse.Composer.EDIT,
|
action: Discourse.Composer.EDIT,
|
||||||
draftKey: post.get('topic.draft_key'),
|
draftKey: post.get('topic.draft_key'),
|
||||||
draftSequence: post.get('topic.draft_sequence')
|
draftSequence: post.get('topic.draft_sequence')
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// Cancel and reopen the composer for the first post
|
||||||
|
if (composerModel && (post.get('firstPost') || composerModel.get('editingPost'))) {
|
||||||
|
composer.cancelComposer().then(() => composer.open(opts));
|
||||||
|
} else {
|
||||||
|
composer.open(opts);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleBookmark(post) {
|
toggleBookmark(post) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue