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
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerry Archibald committed Oct 11, 2022
1 parent 7c1c495 commit 39d0440
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 @@ -51,5 +51,5 @@ export async function createLocalNotificationSettingsIfNeeded(cli: MatrixClient)
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 @@ -81,8 +81,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 39d0440

Please sign in to comment.