Do not generate notification when disabled
Generating identicons for notifications is costly even if they are cached. Avoid this extra load when notifications are not going to be shown anyway.
This commit is contained in:
parent
23b3d34eef
commit
847cc3e055
2 changed files with 7 additions and 0 deletions
|
@ -5066,6 +5066,12 @@ export class ConversationModel extends window.Backbone.Model<
|
|||
}
|
||||
|
||||
async notify(message: WhatIsThis, reaction?: WhatIsThis): Promise<void> {
|
||||
// As a performance optimization don't perform any work if notifications are
|
||||
// disabled.
|
||||
if (!window.Whisper.Notifications.isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isMuted()) {
|
||||
return;
|
||||
}
|
||||
|
|
1
ts/window.d.ts
vendored
1
ts/window.d.ts
vendored
|
@ -708,6 +708,7 @@ export type WhisperType = {
|
|||
BodyRangeType: BodyRangeType;
|
||||
|
||||
Notifications: {
|
||||
isEnabled: boolean;
|
||||
removeBy: (filter: Partial<unknown>) => void;
|
||||
add: (notification: unknown) => void;
|
||||
clear: () => void;
|
||||
|
|
Loading…
Reference in a new issue