Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
use correct default for notification silencing (#9388)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9e055ee)
  • Loading branch information
Kerry authored and github-actions[bot] committed Oct 11, 2022
1 parent 9dc82fb commit 0479f7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ export function getLocalNotificationAccountDataEventType(deviceId: string): stri
export function localNotificationsAreSilenced(cli: MatrixClient): boolean {
const eventType = getLocalNotificationAccountDataEventType(cli.deviceId);
const event = cli.getAccountData(eventType);
return event?.getContent<LocalNotificationSettings>()?.is_silenced ?? true;
return event?.getContent<LocalNotificationSettings>()?.is_silenced ?? false;
}
4 changes: 2 additions & 2 deletions test/utils/notifications-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ describe('notifications', () => {
});

describe('localNotificationsAreSilenced', () => {
it('defaults to true when no setting exists', () => {
expect(localNotificationsAreSilenced(mockClient)).toBeTruthy();
it('defaults to false when no setting exists', () => {
expect(localNotificationsAreSilenced(mockClient)).toBeFalsy();
});
it('checks the persisted value', () => {
mockClient.setAccountData(accountDataEventKey, { is_silenced: true });
Expand Down

0 comments on commit 0479f7f

Please sign in to comment.