Only try to delete room rule if it exists

pull/21833/head
David Baker 2016-08-18 16:59:25 +01:00
parent e29be619c9
commit 5495cfaca9
1 changed files with 4 additions and 1 deletions

View File

@ -100,7 +100,10 @@ function setRoomNotifsStateUnmuted(roomId, newState) {
} }
if (newState == 'all_messages') { if (newState == 'all_messages') {
promises.push(cli.deletePushRule('global', 'room', roomId)); const roomRule = cli.getRoomPushRule('global', roomId);
if (roomRule) {
promises.push(cli.deletePushRule('global', 'room', roomRule.rule_id));
}
} else if (newState == 'mentions_only') { } else if (newState == 'mentions_only') {
promises.push(cli.addPushRule('global', 'room', roomId, { promises.push(cli.addPushRule('global', 'room', roomId, {
actions: [ actions: [