mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 19:06:09 +00:00
Extract compose.same_recipient_as_before()
(imported from commit 2ba8589127e3a0e86c00bb52a22be01bcad48a5d)
This commit is contained in:
@@ -145,6 +145,15 @@ function fill_in_opts_from_current_narrowed_view(msg_type, opts) {
|
|||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function same_recipient_as_before(msg_type, opts) {
|
||||||
|
return (compose.composing() === msg_type) &&
|
||||||
|
((msg_type === "stream" &&
|
||||||
|
opts.stream === compose.stream_name() &&
|
||||||
|
opts.subject === compose.subject()) ||
|
||||||
|
(msg_type === "private" &&
|
||||||
|
opts.private_message_recipient === compose.recipient()));
|
||||||
|
}
|
||||||
|
|
||||||
exports.start = function (msg_type, opts) {
|
exports.start = function (msg_type, opts) {
|
||||||
if (reload.is_in_progress()) {
|
if (reload.is_in_progress()) {
|
||||||
return;
|
return;
|
||||||
@@ -156,12 +165,7 @@ exports.start = function (msg_type, opts) {
|
|||||||
|
|
||||||
opts = fill_in_opts_from_current_narrowed_view(msg_type, opts);
|
opts = fill_in_opts_from_current_narrowed_view(msg_type, opts);
|
||||||
|
|
||||||
if (!(compose.composing() === msg_type &&
|
if (!same_recipient_as_before(msg_type, opts)) {
|
||||||
((msg_type === "stream" &&
|
|
||||||
opts.stream === compose.stream_name() &&
|
|
||||||
opts.subject === compose.subject()) ||
|
|
||||||
(msg_type === "private" &&
|
|
||||||
opts.private_message_recipient === compose.recipient())))) {
|
|
||||||
// Clear the compose box if the existing message is to a different recipient
|
// Clear the compose box if the existing message is to a different recipient
|
||||||
clear_box();
|
clear_box();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user