From 415693bd834b14b946e492c9914782632e4cfe0b Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 29 Sep 2017 14:02:31 -0600 Subject: [PATCH] Support editing power levels of events. Signed-off-by: Travis Ralston --- src/components/views/rooms/RoomSettings.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 0fea50d2fa..b2d8aa7fe5 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -364,6 +364,11 @@ module.exports = React.createClass({ var powerLevels = this.props.room.currentState.getStateEvents('m.room.power_levels', ''); powerLevels = powerLevels ? powerLevels.getContent() : {}; + for (let key of Object.keys(this.refs).filter(k => k.startsWith("event_levels_"))) { + const eventType = key.substring("event_levels_".length); + powerLevels.events[eventType] = parseInt(this.refs[key].getValue()); + } + var newPowerLevels = { ban: parseInt(this.refs.ban.getValue()), kick: parseInt(this.refs.kick.getValue()), @@ -883,7 +888,8 @@ module.exports = React.createClass({ return (
{ _t('To send events of type') } { event_type }, { _t('you must be a') } - +
); })}