mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
notifications: split message_is_notifiable into multiple ifs for clarity.
(imported from commit 33d1e2135a87192cc4d964db534b31ae9335595a)
This commit is contained in:
@@ -301,13 +301,31 @@ exports.speaking_at_me = function (message) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function message_is_notifiable(message) {
|
function message_is_notifiable(message) {
|
||||||
// based purely on message contents, can we notify the user about the message?
|
// Based purely on message contents, can we notify the user about
|
||||||
return (!message.sent_by_me &&
|
// the message?
|
||||||
(message.type === "private" ||
|
|
||||||
exports.speaking_at_me(message) ||
|
// First, does anything disqualify it from being notifiable?
|
||||||
(message.type === "stream" &&
|
if (message.sent_by_me) {
|
||||||
subs.receives_notifications(message.stream)) ||
|
return false;
|
||||||
alert_words.notifies(message)));
|
}
|
||||||
|
|
||||||
|
// Then, do any properties make it notifiable?
|
||||||
|
if (message.type === "private") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (exports.speaking_at_me(message)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ((message.type === "stream") &&
|
||||||
|
subs.receives_notifications(message.stream)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (alert_words.notifies(message)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nope.
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.received_messages = function (messages) {
|
exports.received_messages = function (messages) {
|
||||||
|
|||||||
Reference in New Issue
Block a user