From c6d9ec42a2a4545f44f00635cdeb91d90fda3af3 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 6 Jul 2017 12:51:55 +0100 Subject: [PATCH] only show unban button in RoomSettings if user has sufficient PL to do so Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomSettings.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 171af4764b..d255670a52 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -39,6 +39,7 @@ function parseIntWithDefault(val, def) { const BannedUser = React.createClass({ propTypes: { + canUnban: React.PropTypes.bool, member: React.PropTypes.object.isRequired, // js-sdk RoomMember reason: React.PropTypes.string, }, @@ -67,13 +68,17 @@ const BannedUser = React.createClass({ }, render: function() { + let unbanButton; + + if (this.props.canUnban) { + unbanButton = + { _t('Unban') } + ; + } + return (
  • - - { _t('Unban') } - + { unbanButton } {this.props.member.name} {this.props.member.userId} {this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : ""}
  • @@ -667,6 +672,7 @@ module.exports = React.createClass({ const banned = this.props.room.getMembersWithMembership("ban"); let bannedUsersSection; if (banned.length) { + const canBanUsers = current_user_level >= ban_level; bannedUsersSection =

    { _t('Banned users') }

    @@ -674,7 +680,7 @@ module.exports = React.createClass({ {banned.map(function(member) { const banEvent = member.events.member.getContent(); return ( - + ); })}