Don't count muted convos in badge count by default
This commit is contained in:
parent
64c3a6eae0
commit
22ba54ce5c
14 changed files with 115 additions and 28 deletions
|
@ -32,10 +32,13 @@ export function start(): void {
|
|||
this.listenTo(conversations, 'add change:active_at', this.addActive);
|
||||
this.listenTo(conversations, 'reset', () => this.reset([]));
|
||||
|
||||
this.on(
|
||||
'add remove change:unreadCount',
|
||||
debounce(this.updateUnreadCount.bind(this), 1000)
|
||||
const debouncedUpdateUnreadCount = debounce(
|
||||
this.updateUnreadCount.bind(this),
|
||||
1000
|
||||
);
|
||||
|
||||
this.on('add remove change:unreadCount', debouncedUpdateUnreadCount);
|
||||
window.Whisper.events.on('updateUnreadCount', debouncedUpdateUnreadCount);
|
||||
},
|
||||
addActive(model: ConversationModelType) {
|
||||
if (model.get('active_at')) {
|
||||
|
@ -45,8 +48,13 @@ export function start(): void {
|
|||
}
|
||||
},
|
||||
updateUnreadCount() {
|
||||
const canCountMutedConversations = window.storage.get(
|
||||
'badge-count-muted-conversations'
|
||||
);
|
||||
const newUnreadCount = reduce(
|
||||
this.map((m: ConversationModelType) => m.get('unreadCount')),
|
||||
this.map((m: ConversationModelType) =>
|
||||
!canCountMutedConversations && m.isMuted() ? 0 : m.get('unreadCount')
|
||||
),
|
||||
(item: number, memo: number) => (item || 0) + memo,
|
||||
0
|
||||
);
|
||||
|
|
1
ts/model-types.d.ts
vendored
1
ts/model-types.d.ts
vendored
|
@ -178,6 +178,7 @@ export declare class ConversationModelType extends Backbone.Model<
|
|||
isFromOrAddedByTrustedContact(): boolean;
|
||||
isBlocked(): boolean;
|
||||
isMe(): boolean;
|
||||
isMuted(): boolean;
|
||||
isPrivate(): boolean;
|
||||
isVerified(): boolean;
|
||||
maybeRepairGroupV2(data: {
|
||||
|
|
|
@ -308,7 +308,7 @@
|
|||
"rule": "jQuery-appendTo(",
|
||||
"path": "js/settings_start.js",
|
||||
"line": " window.view.$el.appendTo($body);",
|
||||
"lineNumber": 55,
|
||||
"lineNumber": 56,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Interacting with already-existing DOM nodes"
|
||||
|
@ -994,17 +994,26 @@
|
|||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " el: this.$('.spell-check-setting'),",
|
||||
"line": " el: this.$('.badge-count-muted-conversations-setting'),",
|
||||
"lineNumber": 131,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
},
|
||||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " el: this.$('.spell-check-setting'),",
|
||||
"lineNumber": 137,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
},
|
||||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " const $msg = this.$('.spell-check-setting-message');",
|
||||
"lineNumber": 135,
|
||||
"lineNumber": 141,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
|
@ -1013,7 +1022,7 @@
|
|||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " el: this.$('.menu-bar-setting'),",
|
||||
"lineNumber": 148,
|
||||
"lineNumber": 154,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
|
@ -1022,15 +1031,6 @@
|
|||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " el: this.$('.always-relay-calls-setting'),",
|
||||
"lineNumber": 155,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
},
|
||||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " el: this.$('.call-ringtone-notification-setting'),",
|
||||
"lineNumber": 161,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
|
@ -1039,7 +1039,7 @@
|
|||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " el: this.$('.call-system-notification-setting'),",
|
||||
"line": " el: this.$('.call-ringtone-notification-setting'),",
|
||||
"lineNumber": 167,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
|
@ -1048,7 +1048,7 @@
|
|||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " el: this.$('.incoming-call-notification-setting'),",
|
||||
"line": " el: this.$('.call-system-notification-setting'),",
|
||||
"lineNumber": 173,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
|
@ -1057,17 +1057,26 @@
|
|||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " el: this.$('.media-permissions'),",
|
||||
"line": " el: this.$('.incoming-call-notification-setting'),",
|
||||
"lineNumber": 179,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
},
|
||||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " el: this.$('.media-permissions'),",
|
||||
"lineNumber": 185,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
},
|
||||
{
|
||||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " el: this.$('.media-camera-permissions'),",
|
||||
"lineNumber": 184,
|
||||
"lineNumber": 190,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
|
@ -1076,7 +1085,7 @@
|
|||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " this.$('.sync-setting').append(syncView.el);",
|
||||
"lineNumber": 190,
|
||||
"lineNumber": 196,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
|
@ -1085,7 +1094,7 @@
|
|||
"rule": "jQuery-append(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " this.$('.sync-setting').append(syncView.el);",
|
||||
"lineNumber": 190,
|
||||
"lineNumber": 196,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Interacting with already-existing DOM nodes"
|
||||
|
@ -1094,7 +1103,7 @@
|
|||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " this.$('.sync').text(i18n('syncNow'));",
|
||||
"lineNumber": 271,
|
||||
"lineNumber": 280,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
|
@ -1112,7 +1121,7 @@
|
|||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " this.$('.sync').attr('disabled', 'disabled');",
|
||||
"lineNumber": 275,
|
||||
"lineNumber": 284,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
|
@ -1130,7 +1139,7 @@
|
|||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " this.$('.synced_at').hide();",
|
||||
"lineNumber": 287,
|
||||
"lineNumber": 296,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
|
@ -1148,7 +1157,7 @@
|
|||
"rule": "jQuery-$(",
|
||||
"path": "js/views/settings_view.js",
|
||||
"line": " this.$('.sync_failed').hide();",
|
||||
"lineNumber": 292,
|
||||
"lineNumber": 301,
|
||||
"reasonCategory": "usageTrusted",
|
||||
"updated": "2020-08-21T11:29:29.636Z",
|
||||
"reasonDetail": "Protected from arbitrary input"
|
||||
|
|
2
ts/window.d.ts
vendored
2
ts/window.d.ts
vendored
|
@ -40,6 +40,7 @@ declare global {
|
|||
getCallRingtoneNotification: () => Promise<boolean>;
|
||||
getCallSystemNotification: () => Promise<boolean>;
|
||||
getConversations: () => ConversationModelCollectionType;
|
||||
getCountMutedConversations: () => Promise<boolean>;
|
||||
getEnvironment: () => string;
|
||||
getExpiration: () => string;
|
||||
getGuid: () => string;
|
||||
|
@ -208,6 +209,7 @@ export type LoggerType = (...args: Array<any>) => void;
|
|||
|
||||
export type WhisperType = {
|
||||
events: {
|
||||
on: (name: string, callback: (param1: any, param2?: any) => void) => void;
|
||||
trigger: (name: string, param1: any, param2?: any) => void;
|
||||
};
|
||||
Database: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue