Fix crash on load and room creation (#418)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user