compose: Check if raw_content is present when quoting.

If `raw_content` is already present for the selected message, there is
no need to make a request to the server.
This commit is contained in:
Marco Burstein
2018-11-11 10:36:26 -08:00
committed by Tim Abbott
parent 6546fb3f1d
commit f37e4df471
2 changed files with 25 additions and 0 deletions

View File

@@ -388,10 +388,17 @@ exports.on_topic_narrow = function () {
exports.quote_and_reply = function (opts) {
var textarea = $("#compose-textarea");
var message_id = current_msg_list.selected_id();
var message = current_msg_list.selected_message();
exports.respond_to_message(opts);
compose_ui.insert_syntax_and_focus("[Quoting…]\n", textarea);
if (message && message.raw_content) {
compose_ui.replace_syntax('[Quoting…]', '```quote\n' + message.raw_content + '\n```', textarea);
$("#compose-textarea").trigger("autosize.resize");
return;
}
channel.get({
url: '/json/messages/' + message_id,
idempotent: true,