diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 4d1285678b..3247f5a90b 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2017 Vector Creations Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -35,6 +36,47 @@ function parseIntWithDefault(val, def) { return isNaN(res) ? def : res; } +const BannedUser = React.createClass({ + propTypes: { + member: React.PropTypes.object.isRequired, // js-sdk RoomMember + }, + + _onUnbanClick: function() { + const ConfirmUserActionDialog = sdk.getComponent("dialogs.ConfirmUserActionDialog"); + Modal.createDialog(ConfirmUserActionDialog, { + member: this.props.member, + action: 'Unban', + danger: false, + onFinished: (proceed) => { + if (!proceed) return; + + MatrixClientPeg.get().unban( + this.props.member.roomId, this.props.member.userId, + ).catch((err) => { + const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + Modal.createDialog(ErrorDialog, { + title: "Failed to unban", + description: err.message, + }); + }).done(); + }, + }); + }, + + render: function() { + return ( +