From a473971c7b6f84b8b16717883045b18248057265 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 5 Jan 2018 11:11:20 +0000 Subject: [PATCH] negate for less indentation Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/MemberInfo.js | 78 ++++++++++++------------ 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js index 9ea749c98e..5afd0a4a64 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -445,47 +445,49 @@ module.exports = withMatrixClient(React.createClass({ const powerLevelEvent = room.currentState.getStateEvents("m.room.power_levels", ""); if (!powerLevelEvent) return; - if (powerLevelEvent.getContent().users) { - const myUserId = this.props.matrixClient.getUserId(); - const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); + if (!powerLevelEvent.getContent().users) { + this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent); + return; + } - if (myUserId === target) { - Modal.createTrackedDialog('Demoting Self', '', QuestionDialog, { - title: _t("Warning!"), - description: -
- { _t("You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.") }
- { _t("Are you sure?") } -
, - button: _t("Continue"), - onFinished: (confirmed) => { - if (confirmed) { - this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent); - } - }, - }); - return; - } + const myUserId = this.props.matrixClient.getUserId(); + const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); - const myPower = powerLevelEvent.getContent().users[myUserId]; - if (parseInt(myPower) === parseInt(powerLevel)) { - Modal.createTrackedDialog('Promote to PL100 Warning', '', QuestionDialog, { - title: _t("Warning!"), - description: -
- { _t("You will not be able to undo this change as you are promoting the user to have the same power level as yourself.") }
- { _t("Are you sure?") } -
, - button: _t("Continue"), - onFinished: (confirmed) => { - if (confirmed) { - this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent); - } - }, - }); - return; - } + if (myUserId === target) { + Modal.createTrackedDialog('Demoting Self', '', QuestionDialog, { + title: _t("Warning!"), + description: +
+ { _t("You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.") }
+ { _t("Are you sure?") } +
, + button: _t("Continue"), + onFinished: (confirmed) => { + if (confirmed) { + this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent); + } + }, + }); + return; + } + const myPower = powerLevelEvent.getContent().users[myUserId]; + if (parseInt(myPower) === parseInt(powerLevel)) { + Modal.createTrackedDialog('Promote to PL100 Warning', '', QuestionDialog, { + title: _t("Warning!"), + description: +
+ { _t("You will not be able to undo this change as you are promoting the user to have the same power level as yourself.") }
+ { _t("Are you sure?") } +
, + button: _t("Continue"), + onFinished: (confirmed) => { + if (confirmed) { + this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent); + } + }, + }); + return; } this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent); },