Don't count muted convos in badge count by default

This commit is contained in:
Josh Perez 2020-09-14 18:16:57 -04:00 committed by Josh Perez
parent 64c3a6eae0
commit 22ba54ce5c
14 changed files with 115 additions and 28 deletions

View file

@ -381,6 +381,12 @@
storage.put('notification-draw-attention', value),
getAudioNotification: () => storage.get('audio-notification'),
setAudioNotification: value => storage.put('audio-notification', value),
getCountMutedConversations: () =>
storage.get('badge-count-muted-conversations', false),
setCountMutedConversations: value => {
storage.put('badge-count-muted-conversations', value);
window.Whisper.events.trigger('updateUnreadCount');
},
getCallRingtoneNotification: () =>
storage.get('call-ringtone-notification', true),
setCallRingtoneNotification: value =>

View file

@ -3107,8 +3107,14 @@
});
},
isMuted() {
return (
this.get('muteExpiresAt') && Date.now() < this.get('muteExpiresAt')
);
},
async notify(message, reaction) {
if (this.get('muteExpiresAt') && Date.now() < this.get('muteExpiresAt')) {
if (this.isMuted()) {
return;
}

View file

@ -30,6 +30,7 @@ const getInitialData = async () => ({
notificationSetting: await window.getNotificationSetting(),
audioNotification: await window.getAudioNotification(),
notificationDrawAttention: await window.getNotificationDrawAttention(),
countMutedConversations: await window.getCountMutedConversations(),
spellCheck: await window.getSpellCheck(),

View file

@ -127,6 +127,12 @@
setFn: window.setAudioNotification,
});
}
new CheckboxView({
el: this.$('.badge-count-muted-conversations-setting'),
name: 'badge-count-muted-conversations-setting',
value: window.initialData.countMutedConversations,
setFn: window.setCountMutedConversations,
});
new CheckboxView({
el: this.$('.spell-check-setting'),
name: 'spell-check-setting',
@ -224,6 +230,9 @@
clearDataButton: i18n('clearDataButton'),
clearDataExplanation: i18n('clearDataExplanation'),
calling: i18n('calling'),
countMutedConversationsDescription: i18n(
'countMutedConversationsDescription'
),
alwaysRelayCallsDescription: i18n('alwaysRelayCallsDescription'),
alwaysRelayCallsDetail: i18n('alwaysRelayCallsDetail'),
callRingtoneNotificationDescription: i18n(