Fix crash on load and room creation (#418)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
005434f79b
commit
e8d6ccec9a
2 changed files with 12 additions and 2 deletions
|
@ -35,7 +35,12 @@ const items = [{
|
||||||
function setRoomNotifType(roomId, newType) {
|
function setRoomNotifType(roomId, newType) {
|
||||||
const mx = initMatrix.matrixClient;
|
const mx = initMatrix.matrixClient;
|
||||||
const { notifications } = initMatrix;
|
const { notifications } = initMatrix;
|
||||||
const roomPushRule = mx.getRoomPushRule('global', roomId);
|
let roomPushRule;
|
||||||
|
try {
|
||||||
|
roomPushRule = mx.getRoomPushRule('global', roomId);
|
||||||
|
} catch {
|
||||||
|
roomPushRule = undefined;
|
||||||
|
}
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
if (newType === cons.notifs.MUTE) {
|
if (newType === cons.notifs.MUTE) {
|
||||||
|
|
|
@ -83,7 +83,12 @@ class Notifications extends EventEmitter {
|
||||||
|
|
||||||
getNotiType(roomId) {
|
getNotiType(roomId) {
|
||||||
const mx = this.matrixClient;
|
const mx = this.matrixClient;
|
||||||
const pushRule = mx.getRoomPushRule('global', roomId);
|
let pushRule;
|
||||||
|
try {
|
||||||
|
pushRule = mx.getRoomPushRule('global', roomId);
|
||||||
|
} catch {
|
||||||
|
pushRule = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
if (pushRule === undefined) {
|
if (pushRule === undefined) {
|
||||||
const overrideRules = mx.getAccountData('m.push_rules')?.getContent()?.global?.override;
|
const overrideRules = mx.getAccountData('m.push_rules')?.getContent()?.global?.override;
|
||||||
|
|
Loading…
Reference in a new issue