mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
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:
committed by
Tim Abbott
parent
6546fb3f1d
commit
f37e4df471
@@ -283,6 +283,24 @@ run_test('quote_and_reply', () => {
|
||||
};
|
||||
|
||||
quote_and_reply(opts);
|
||||
|
||||
current_msg_list.selected_message = function () {
|
||||
return {
|
||||
type: 'stream',
|
||||
stream: 'devel',
|
||||
subject: 'test',
|
||||
reply_to: 'bob',
|
||||
sender_full_name: 'Bob',
|
||||
sender_id: 40,
|
||||
raw_content: 'Testing.',
|
||||
};
|
||||
};
|
||||
|
||||
channel.get = function () {
|
||||
assert.fail('channel.get should not be used if raw_content is present');
|
||||
};
|
||||
|
||||
quote_and_reply(opts);
|
||||
});
|
||||
|
||||
run_test('get_focus_area', () => {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user