mirror of
https://github.com/zulip/zulip.git
synced 2025-10-30 19:43:47 +00:00
notifications: Add 'none' to unread count options.
This commit is contained in:
committed by
Tim Abbott
parent
330d065a69
commit
e4f0d3d79b
@@ -50,6 +50,11 @@ function test_notifiable_count(home_unread_messages, expected_notifiable_count)
|
||||
});
|
||||
notifiable_counts = unread.get_notifiable_count();
|
||||
assert.deepEqual(notifiable_counts, expected_notifiable_count);
|
||||
set_global('page_params', {
|
||||
desktop_icon_count_display: 3,
|
||||
});
|
||||
notifiable_counts = unread.get_notifiable_count();
|
||||
assert.deepEqual(notifiable_counts, 0);
|
||||
}
|
||||
|
||||
run_test('empty_counts_while_narrowed', () => {
|
||||
|
||||
@@ -73,6 +73,10 @@ exports.desktop_icon_count_display_values = {
|
||||
code: 2,
|
||||
description: i18n.t("Private messages and mentions"),
|
||||
},
|
||||
none: {
|
||||
code: 3,
|
||||
description: i18n.t("None"),
|
||||
},
|
||||
};
|
||||
|
||||
function change_notification_setting(setting, setting_data, status_element) {
|
||||
|
||||
@@ -552,9 +552,14 @@ exports.calculate_notifiable_count = function (res) {
|
||||
|
||||
var only_show_notifiable = page_params.desktop_icon_count_display ===
|
||||
settings_notifications.desktop_icon_count_display_values.notifiable.code;
|
||||
var no_notifications = page_params.desktop_icon_count_display ===
|
||||
settings_notifications.desktop_icon_count_display_values.none.code;
|
||||
if (only_show_notifiable) {
|
||||
// DESKTOP_ICON_COUNT_DISPLAY_NOTIFIABLE
|
||||
new_message_count = res.mentioned_message_count + res.private_message_count;
|
||||
} else if (no_notifications) {
|
||||
// DESKTOP_ICON_COUNT_DISPLAY_NONE
|
||||
new_message_count = 0;
|
||||
} else {
|
||||
// DESKTOP_ICON_COUNT_DISPLAY_MESSAGES
|
||||
new_message_count = res.home_unread_messages;
|
||||
|
||||
@@ -836,6 +836,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
||||
|
||||
DESKTOP_ICON_COUNT_DISPLAY_MESSAGES = 1
|
||||
DESKTOP_ICON_COUNT_DISPLAY_NOTIFIABLE = 2
|
||||
DESKTOP_ICON_COUNT_DISPLAY_NONE = 3
|
||||
desktop_icon_count_display = models.PositiveSmallIntegerField(
|
||||
default=DESKTOP_ICON_COUNT_DISPLAY_MESSAGES) # type: int
|
||||
|
||||
|
||||
Reference in New Issue
Block a user