From 63ad7640bf8474259beba3576b78df4c2984e3dd Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sun, 14 Jun 2020 01:33:25 +0100
Subject: [PATCH] User Info default power levels for ban/kick/redact to 50 as
per spec
---
src/components/views/right_panel/UserInfo.js | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/components/views/right_panel/UserInfo.js b/src/components/views/right_panel/UserInfo.js
index 34136b2177..1fd5221cdb 100644
--- a/src/components/views/right_panel/UserInfo.js
+++ b/src/components/views/right_panel/UserInfo.js
@@ -748,19 +748,26 @@ const RoomAdminToolsContainer = ({room, children, member, startUpdating, stopUpd
powerLevels.state_default
);
+ // if these do not exist in the event then they should default to 50 as per the spec
+ const {
+ ban: banPowerLevel = 50,
+ kick: kickPowerLevel = 50,
+ redact: redactPowerLevel = 50,
+ } = powerLevels;
+
const me = room.getMember(cli.getUserId());
const isMe = me.userId === member.userId;
const canAffectUser = member.powerLevel < me.powerLevel || isMe;
- if (canAffectUser && me.powerLevel >= powerLevels.kick) {
+ if (canAffectUser && me.powerLevel >= kickPowerLevel) {
kickButton = ;
}
- if (me.powerLevel >= powerLevels.redact) {
+ if (me.powerLevel >= redactPowerLevel) {
redactButton = (
);
}
- if (canAffectUser && me.powerLevel >= powerLevels.ban) {
+ if (canAffectUser && me.powerLevel >= banPowerLevel) {
banButton = ;
}
if (canAffectUser && me.powerLevel >= editPowerLevel) {