mirror of https://github.com/vector-im/riot-web
Treat null/undefined notification settings as "not set"
Otherwise we end up lying and saying notifications are disabled, despite the push rules saying otherwise. Part 1 of the fix for: * https://github.com/vector-im/riot-web/issues/5603 * https://github.com/vector-im/riot-web/issues/5606 Signed-off-by: Travis Ralston <travpc@gmail.com>pull/21833/head
parent
10a1d9cb29
commit
5976fb2eed
|
@ -40,11 +40,17 @@ export default class DeviceSettingsHandler extends SettingsHandler {
|
|||
|
||||
// Special case notifications
|
||||
if (settingName === "notificationsEnabled") {
|
||||
return localStorage.getItem("notifications_enabled") === "true";
|
||||
const value = localStorage.getItem("notifications_enabled");
|
||||
if (typeof(value) === "string") return value === "true";
|
||||
return null; // wrong type or otherwise not set
|
||||
} else if (settingName === "notificationBodyEnabled") {
|
||||
return localStorage.getItem("notifications_body_enabled") === "true";
|
||||
const value = localStorage.getItem("notifications_body_enabled");
|
||||
if (typeof(value) === "string") return value === "true";
|
||||
return null; // wrong type or otherwise not set
|
||||
} else if (settingName === "audioNotificationsEnabled") {
|
||||
return localStorage.getItem("audio_notifications_enabled") === "true";
|
||||
const value = localStorage.getItem("audio_notifications_enabled");
|
||||
if (typeof(value) === "string") return value === "true";
|
||||
return null; // wrong type or otherwise not set
|
||||
}
|
||||
|
||||
return this._getSettings()[settingName];
|
||||
|
|
Loading…
Reference in New Issue