From 088f9e4cc5670cf93a17d6a9f0a2f6ff9c6e4964 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 9 Sep 2019 12:50:05 +0100 Subject: [PATCH] Catch error from changing room power level requirements and show modal Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../settings/tabs/room/RolesRoomSettingsTab.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js b/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js index 002748694c..64f3992ad0 100644 --- a/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/RolesRoomSettingsTab.js @@ -148,7 +148,18 @@ export default class RolesRoomSettingsTab extends React.Component { parentObj[keyPath[keyPath.length - 1]] = value; } - client.sendStateEvent(this.props.roomId, "m.room.power_levels", plContent); + client.sendStateEvent(this.props.roomId, "m.room.power_levels", plContent).catch(e => { + console.error(e); + + const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + Modal.createTrackedDialog('Power level requirement change failed', '', ErrorDialog, { + title: _t('Error changing power level requirement'), + description: _t( + "An error occurred changing the room's power level requirements. Ensure you have sufficient " + + "permissions and try again.", + ), + }); + }); }; _onUserPowerLevelChanged = (value, powerLevelKey) => {