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

use correct default for notification silencing #9388

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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