Merge pull request #3649 from tgxworld/click_reply_should_clear_edit

Click reply should clear edit
This commit is contained in:
Sam
2015-08-21 10:36:21 +10:00
6 changed files with 75 additions and 7 deletions

View File

@@ -398,7 +398,8 @@ export default Ember.Controller.extend({
// If we're already open, we don't have to do anything
if (composerModel.get('composeState') === Discourse.Composer.OPEN &&
composerModel.get('draftKey') === opts.draftKey) {
composerModel.get('draftKey') === opts.draftKey &&
composerModel.get('action') === opts.action ) {
return resolve();
}
@@ -406,7 +407,7 @@ export default Ember.Controller.extend({
if (composerModel.get('composeState') === Discourse.Composer.DRAFT &&
composerModel.get('draftKey') === opts.draftKey) {
composerModel.set('composeState', Discourse.Composer.OPEN);
return resolve();
if (composerModel.get('action') === opts.action) return resolve();
}
// If it's a different draft, cancel it and try opening again.

View File

@@ -371,12 +371,11 @@ const Composer = RestModel.extend({
const composer = this;
if (!replyBlank &&
(opts.action !== this.get('action') || ((opts.reply || opts.action === this.EDIT) && this.get('reply') !== this.get('originalText'))) &&
!opts.tested) {
opts.tested = true;
((opts.reply || opts.action === this.EDIT) && this.get('replyDirty'))) {
return;
}
if (opts.action === REPLY && this.get('action') === EDIT) this.set('reply', '');
if (!opts.draftKey) throw 'draft key is required';
if (opts.draftSequence === null) throw 'draft sequence is required';