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:
parent
9c54915e73
commit
699bbee544
1 changed files with 2 additions and 1 deletions
|
@ -179,6 +179,7 @@ function RoomPermissions({ roomId }) {
|
||||||
const pLEvent = room.currentState.getStateEvents('m.room.power_levels')[0];
|
const pLEvent = room.currentState.getStateEvents('m.room.power_levels')[0];
|
||||||
const permissions = pLEvent.getContent();
|
const permissions = pLEvent.getContent();
|
||||||
const canChangePermission = room.currentState.maySendStateEvent('m.room.power_levels', mx.getUserId());
|
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 handlePowerSelector = (e, permKey, parentKey, powerLevel) => {
|
||||||
const handlePowerLevelChange = (newPowerLevel) => {
|
const handlePowerLevelChange = (newPowerLevel) => {
|
||||||
|
@ -208,7 +209,7 @@ function RoomPermissions({ roomId }) {
|
||||||
(closeMenu) => (
|
(closeMenu) => (
|
||||||
<PowerLevelSelector
|
<PowerLevelSelector
|
||||||
value={powerLevel}
|
value={powerLevel}
|
||||||
max={100}
|
max={myPowerLevel}
|
||||||
onSelect={(pl) => {
|
onSelect={(pl) => {
|
||||||
closeMenu();
|
closeMenu();
|
||||||
handlePowerLevelChange(pl);
|
handlePowerLevelChange(pl);
|
||||||
|
|
Loading…
Reference in a new issue