negate for less indentation
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
f67d405732
commit
a473971c7b
1 changed files with 40 additions and 38 deletions
|
@ -445,47 +445,49 @@ module.exports = withMatrixClient(React.createClass({
|
||||||
const powerLevelEvent = room.currentState.getStateEvents("m.room.power_levels", "");
|
const powerLevelEvent = room.currentState.getStateEvents("m.room.power_levels", "");
|
||||||
if (!powerLevelEvent) return;
|
if (!powerLevelEvent) return;
|
||||||
|
|
||||||
if (powerLevelEvent.getContent().users) {
|
if (!powerLevelEvent.getContent().users) {
|
||||||
const myUserId = this.props.matrixClient.getUserId();
|
this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent);
|
||||||
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (myUserId === target) {
|
const myUserId = this.props.matrixClient.getUserId();
|
||||||
Modal.createTrackedDialog('Demoting Self', '', QuestionDialog, {
|
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||||
title: _t("Warning!"),
|
|
||||||
description:
|
|
||||||
<div>
|
|
||||||
{ _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.") }<br />
|
|
||||||
{ _t("Are you sure?") }
|
|
||||||
</div>,
|
|
||||||
button: _t("Continue"),
|
|
||||||
onFinished: (confirmed) => {
|
|
||||||
if (confirmed) {
|
|
||||||
this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const myPower = powerLevelEvent.getContent().users[myUserId];
|
if (myUserId === target) {
|
||||||
if (parseInt(myPower) === parseInt(powerLevel)) {
|
Modal.createTrackedDialog('Demoting Self', '', QuestionDialog, {
|
||||||
Modal.createTrackedDialog('Promote to PL100 Warning', '', QuestionDialog, {
|
title: _t("Warning!"),
|
||||||
title: _t("Warning!"),
|
description:
|
||||||
description:
|
<div>
|
||||||
<div>
|
{ _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.") }<br />
|
||||||
{ _t("You will not be able to undo this change as you are promoting the user to have the same power level as yourself.") }<br />
|
{ _t("Are you sure?") }
|
||||||
{ _t("Are you sure?") }
|
</div>,
|
||||||
</div>,
|
button: _t("Continue"),
|
||||||
button: _t("Continue"),
|
onFinished: (confirmed) => {
|
||||||
onFinished: (confirmed) => {
|
if (confirmed) {
|
||||||
if (confirmed) {
|
this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent);
|
||||||
this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent);
|
}
|
||||||
}
|
},
|
||||||
},
|
});
|
||||||
});
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
const myPower = powerLevelEvent.getContent().users[myUserId];
|
||||||
|
if (parseInt(myPower) === parseInt(powerLevel)) {
|
||||||
|
Modal.createTrackedDialog('Promote to PL100 Warning', '', QuestionDialog, {
|
||||||
|
title: _t("Warning!"),
|
||||||
|
description:
|
||||||
|
<div>
|
||||||
|
{ _t("You will not be able to undo this change as you are promoting the user to have the same power level as yourself.") }<br />
|
||||||
|
{ _t("Are you sure?") }
|
||||||
|
</div>,
|
||||||
|
button: _t("Continue"),
|
||||||
|
onFinished: (confirmed) => {
|
||||||
|
if (confirmed) {
|
||||||
|
this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent);
|
this._applyPowerChange(roomId, target, powerLevel, powerLevelEvent);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue