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:
Steve Howell
2017-07-18 14:03:14 -04:00
committed by Tim Abbott
parent b5cb21ab2c
commit eb2659a26a
2 changed files with 16 additions and 9 deletions

View File

@@ -536,13 +536,18 @@ function get_message_header(message) {
return "PM with " + message.display_reply_to;
}
exports.possibly_notify_new_messages_outside_viewport = function (messages, local_id) {
// A warning should only be displayed when the message was sent by the user and
// this is the tab they sent it in.
exports.notify_local_mixes = function (messages) {
/*
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) {
return;
}
This code is called after we insert messages into our
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) {
if (!people.is_my_user_id(message.sender_id)) {