From 014ea9a3287dcfb6d56cc932909456092337b9e1 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 16 Mar 2016 12:09:26 +0000 Subject: [PATCH] switch to using MatrixClientPeg.get().maySendStateEvent() everywhere --- src/components/views/rooms/RoomSettings.js | 34 ++++++++-------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 5a2d124531..145f255a1c 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -272,7 +272,8 @@ module.exports = React.createClass({ var power_levels = this.props.room.currentState.getStateEvents('m.room.power_levels', ''); var events_levels = (power_levels ? power_levels.events : {}) || {}; - var user_id = MatrixClientPeg.get().credentials.userId; + var cli = MatrixClientPeg.get(); + var user_id = cli.credentials.userId; if (power_levels) { power_levels = power_levels.getContent(); @@ -321,18 +322,7 @@ module.exports = React.createClass({ var state_default = (parseInt(power_levels ? power_levels.state_default : 0) || 0); - var canSetEventType = function(eventType) { - if (MatrixClientPeg.get().isGuest()) { - return false; - } - var level = state_default; - if (events_levels[eventType] !== undefined) { - level = events_levels[eventType]; - } - return current_user_level >= level; - } - - var canSetTag = !MatrixClientPeg.get().isGuest(); + var canSetTag = !cli.isGuest(); var self = this; @@ -425,19 +415,19 @@ module.exports = React.createClass({