fixed warning pop up when admin changes power to custome level 100 (#8248)

pull/21833/head
Jume Brice 2022-04-11 20:52:01 +01:00 committed by GitHub
parent 7b2f1e22e1
commit e90ee38e4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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;