mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 15:09:34 +00:00
local echo: Rename function to notify_local_mixes().
This commit renames possibly_notify_new_messages_outside_viewport() to the more concise name notify_local_mixes(). We really only need to call this function in one place, so we have the caller check the `local_id` condition. We can eventually upstream this code even further so that it's completely obvious that it's only ever called from the local-echo codepath.
This commit is contained in:
@@ -65,13 +65,15 @@ exports.insert_new_messages = function insert_new_messages(messages, local_id) {
|
|||||||
if (narrow_state.active()) {
|
if (narrow_state.active()) {
|
||||||
if (narrow_state.filter().can_apply_locally()) {
|
if (narrow_state.filter().can_apply_locally()) {
|
||||||
message_util.add_messages(messages, message_list.narrowed, {messages_are_new: true});
|
message_util.add_messages(messages, message_list.narrowed, {messages_are_new: true});
|
||||||
notifications.possibly_notify_new_messages_outside_viewport(messages, local_id);
|
|
||||||
} else {
|
} else {
|
||||||
// if we cannot apply locally, we have to wait for this callback to happen to notify
|
// if we cannot apply locally, we have to wait for this callback to happen to notify
|
||||||
maybe_add_narrowed_messages(messages, message_list.narrowed, true);
|
maybe_add_narrowed_messages(messages, message_list.narrowed, true);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
notifications.possibly_notify_new_messages_outside_viewport(messages, local_id);
|
|
||||||
|
|
||||||
|
if (local_id) {
|
||||||
|
notifications.notify_local_mixes(messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.process_loaded_messages(messages);
|
activity.process_loaded_messages(messages);
|
||||||
|
|||||||
@@ -536,13 +536,18 @@ function get_message_header(message) {
|
|||||||
return "PM with " + message.display_reply_to;
|
return "PM with " + message.display_reply_to;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.possibly_notify_new_messages_outside_viewport = function (messages, local_id) {
|
exports.notify_local_mixes = function (messages) {
|
||||||
// A warning should only be displayed when the message was sent by the user and
|
/*
|
||||||
// this is the tab they sent it in.
|
This code should only be called when we are locally echoing
|
||||||
|
messages. It notifies users that their messages aren't
|
||||||
|
actually in the view that they composed to.
|
||||||
|
|
||||||
if (local_id === undefined) {
|
This code is called after we insert messages into our
|
||||||
return;
|
message list widgets. All of the conditions here are
|
||||||
}
|
checkable locally, so we may want to execute this code
|
||||||
|
earlier in the codepath at some point and possibly punt
|
||||||
|
on local rendering.
|
||||||
|
*/
|
||||||
|
|
||||||
_.each(messages, function (message) {
|
_.each(messages, function (message) {
|
||||||
if (!people.is_my_user_id(message.sender_id)) {
|
if (!people.is_my_user_id(message.sender_id)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user