From e90ee38e4bdcabf43e4ec0a7b44c9f01859aca93 Mon Sep 17 00:00:00 2001 From: Jume Brice <38510556+Jumeb@users.noreply.github.com> Date: Mon, 11 Apr 2022 20:52:01 +0100 Subject: [PATCH] fixed warning pop up when admin changes power to custome level 100 (#8248) --- src/components/views/right_panel/UserInfo.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index d36ba0f728..a96a6c2961 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -1024,7 +1024,7 @@ const PowerLevelEditor: React.FC<{ const myUserId = cli.getUserId(); const myPower = powerLevelEvent.getContent().users[myUserId]; - if (myPower && parseInt(myPower) === powerLevel) { + if (myPower && parseInt(myPower) <= powerLevel && myUserId !== target) { const { finished } = Modal.createTrackedDialog('Promote to PL100 Warning', '', QuestionDialog, { title: _t("Warning!"), description: @@ -1038,7 +1038,7 @@ const PowerLevelEditor: React.FC<{ const [confirmed] = await finished; if (!confirmed) return; - } else if (myUserId === target) { + } else if (myUserId === target && myPower && parseInt(myPower) > powerLevel) { // If we are changing our own PL it can only ever be decreasing, which we cannot reverse. try { if (!(await warnSelfDemote(room?.isSpaceRoom()))) return;