mirror of https://github.com/zulip/zulip.git
notifications: Fix desktop/sound notifications for @all.
It appears that previously, these weren't being triggered.
This commit is contained in:
parent
a2c21543bc
commit
07a156c400
|
@ -12,7 +12,6 @@ set_global('page_params', {
|
||||||
set_global('home_msg_list', null);
|
set_global('home_msg_list', null);
|
||||||
set_global('feature_flags', {twenty_four_hour_time: false});
|
set_global('feature_flags', {twenty_four_hour_time: false});
|
||||||
set_global('people', {small_avatar_url: function () { return ''; }});
|
set_global('people', {small_avatar_url: function () { return ''; }});
|
||||||
set_global('notifications', {speaking_at_me: function () {}});
|
|
||||||
set_global('unread', {message_unread: function () {}});
|
set_global('unread', {message_unread: function () {}});
|
||||||
// timerender calls setInterval when imported
|
// timerender calls setInterval when imported
|
||||||
set_global('timerender', {
|
set_global('timerender', {
|
||||||
|
|
|
@ -388,14 +388,6 @@ exports.close_notification = function (message) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.speaking_at_me = function (message) {
|
|
||||||
if (message === undefined) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return message.mentioned_me_directly;
|
|
||||||
};
|
|
||||||
|
|
||||||
function message_is_notifiable(message) {
|
function message_is_notifiable(message) {
|
||||||
// Independent of the user's notification settings, are there
|
// Independent of the user's notification settings, are there
|
||||||
// properties of the message that unconditionally mean we
|
// properties of the message that unconditionally mean we
|
||||||
|
@ -411,15 +403,19 @@ function message_is_notifiable(message) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @-<username> mentions take precedence over muted-ness. @all mentions
|
// @-<username> mentions take precedence over muted-ness. Note
|
||||||
// are suppressed.
|
// that @all mentions are still suppressed by muting.
|
||||||
if (exports.speaking_at_me(message)) {
|
if (message.mentioned_me_directly) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Messages to muted streams that don't mention us specifically
|
||||||
|
// are not notifiable.
|
||||||
if ((message.type === "stream") &&
|
if ((message.type === "stream") &&
|
||||||
!stream_data.in_home_view(message.stream_id)) {
|
!stream_data.in_home_view(message.stream_id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((message.type === "stream") &&
|
if ((message.type === "stream") &&
|
||||||
muting.is_topic_muted(message.stream, message.subject)) {
|
muting.is_topic_muted(message.stream, message.subject)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -452,7 +448,7 @@ function should_send_desktop_notification(message) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exports.speaking_at_me(message) &&
|
if (message.mentioned &&
|
||||||
page_params.enable_desktop_notifications) {
|
page_params.enable_desktop_notifications) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -477,7 +473,7 @@ function should_send_audible_notification(message) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exports.speaking_at_me(message) && page_params.enable_sounds) {
|
if (message.mentioned && page_params.enable_sounds) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue