mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 09:42:46 +08:00
When you click Quote Reply, and then cancel the reply, don't ask if you're sure.
This commit is contained in:
@ -117,12 +117,11 @@ Discourse.QuoteButtonController = Discourse.Controller.extend({
|
|||||||
|
|
||||||
var buffer = this.get('buffer');
|
var buffer = this.get('buffer');
|
||||||
var quotedText = Discourse.Quote.build(post, buffer);
|
var quotedText = Discourse.Quote.build(post, buffer);
|
||||||
|
composerOpts.quote = quotedText;
|
||||||
if (composerController.get('content.replyDirty')) {
|
if (composerController.get('content.replyDirty')) {
|
||||||
composerController.appendText(quotedText);
|
composerController.appendText(quotedText);
|
||||||
} else {
|
} else {
|
||||||
composerController.open(composerOpts).then(function() {
|
composerController.open(composerOpts);
|
||||||
composerController.appendText(quotedText);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
this.set('buffer', '');
|
this.set('buffer', '');
|
||||||
return false;
|
return false;
|
||||||
|
@ -361,6 +361,11 @@ Discourse.Composer = Discourse.Model.extend({
|
|||||||
loading: false
|
loading: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else if (opts.action === REPLY && opts.quote) {
|
||||||
|
this.setProperties({
|
||||||
|
reply: opts.quote,
|
||||||
|
originalText: opts.quote
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (opts.title) { this.set('title', opts.title); }
|
if (opts.title) { this.set('title', opts.title); }
|
||||||
this.set('originalText', opts.draft ? '' : this.get('reply'));
|
this.set('originalText', opts.draft ? '' : this.get('reply'));
|
||||||
|
@ -204,3 +204,13 @@ test('showPreview', function() {
|
|||||||
Discourse.Mobile.mobileView = false;
|
Discourse.Mobile.mobileView = false;
|
||||||
equal(new_composer().get('showPreview'), true, "Show preview by default in desktop view");
|
equal(new_composer().get('showPreview'), true, "Show preview by default in desktop view");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('open with a quote', function() {
|
||||||
|
var quote = '[quote="neil, post:5, topic:413"]\nSimmer down you two.\n[/quote]';
|
||||||
|
var new_composer = function() {
|
||||||
|
return Discourse.Composer.open({action: Discourse.Composer.REPLY, draftKey: 'asfd', draftSequence: 1, quote: quote});
|
||||||
|
};
|
||||||
|
|
||||||
|
equal(new_composer().get('originalText'), quote, "originalText is the quote" );
|
||||||
|
equal(new_composer().get('replyDirty'), false, "replyDirty is initally false with a quote" );
|
||||||
|
});
|
||||||
|
Reference in New Issue
Block a user