Fix max power level in room permissions (#480)

* Fix power level in permissions

Fix allowed value of power level in room permissions, earlier the max value was 100 even if room members have power level more than 100.

* Update RoomPermissions.jsx
This commit is contained in:
Krishan 2022-04-11 21:29:39 +05:30 committed by GitHub
parent 9c54915e73
commit 699bbee544
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -179,6 +179,7 @@ function RoomPermissions({ roomId }) {
const pLEvent = room.currentState.getStateEvents('m.room.power_levels')[0];
const permissions = pLEvent.getContent();
const canChangePermission = room.currentState.maySendStateEvent('m.room.power_levels', mx.getUserId());
const myPowerLevel = room.getMember(mx.getUserId())?.powerLevel ?? 100;
const handlePowerSelector = (e, permKey, parentKey, powerLevel) => {
const handlePowerLevelChange = (newPowerLevel) => {
@ -208,7 +209,7 @@ function RoomPermissions({ roomId }) {
(closeMenu) => (
<PowerLevelSelector
value={powerLevel}
max={100}
max={myPowerLevel}
onSelect={(pl) => {
closeMenu();
handlePowerLevelChange(pl);