use correct default for notification silencing (#9388)
This commit is contained in:
@@ -51,5 +51,5 @@ export async function createLocalNotificationSettingsIfNeeded(cli: MatrixClient)
|
|||||||
export function localNotificationsAreSilenced(cli: MatrixClient): boolean {
|
export function localNotificationsAreSilenced(cli: MatrixClient): boolean {
|
||||||
const eventType = getLocalNotificationAccountDataEventType(cli.deviceId);
|
const eventType = getLocalNotificationAccountDataEventType(cli.deviceId);
|
||||||
const event = cli.getAccountData(eventType);
|
const event = cli.getAccountData(eventType);
|
||||||
return event?.getContent<LocalNotificationSettings>()?.is_silenced ?? true;
|
return event?.getContent<LocalNotificationSettings>()?.is_silenced ?? false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ describe('notifications', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('localNotificationsAreSilenced', () => {
|
describe('localNotificationsAreSilenced', () => {
|
||||||
it('defaults to true when no setting exists', () => {
|
it('defaults to false when no setting exists', () => {
|
||||||
expect(localNotificationsAreSilenced(mockClient)).toBeTruthy();
|
expect(localNotificationsAreSilenced(mockClient)).toBeFalsy();
|
||||||
});
|
});
|
||||||
it('checks the persisted value', () => {
|
it('checks the persisted value', () => {
|
||||||
mockClient.setAccountData(accountDataEventKey, { is_silenced: true });
|
mockClient.setAccountData(accountDataEventKey, { is_silenced: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user