Add reason for ban in room settings

This commit is contained in:
Will Hunt 2017-06-10 16:30:46 +01:00
parent 3b7ce49eab
commit f940d2c100

View File

@ -40,6 +40,7 @@ function parseIntWithDefault(val, def) {
const BannedUser = React.createClass({ const BannedUser = React.createClass({
propTypes: { propTypes: {
member: React.PropTypes.object.isRequired, // js-sdk RoomMember member: React.PropTypes.object.isRequired, // js-sdk RoomMember
reason: React.PropTypes.string,
}, },
_onUnbanClick: function() { _onUnbanClick: function() {
@ -73,10 +74,11 @@ const BannedUser = React.createClass({
> >
{ _t('Unban') } { _t('Unban') }
</AccessibleButton> </AccessibleButton>
{this.props.member.userId} <strong>{this.props.member.name}</strong>
{this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : ""}
</li> </li>
); );
} },
}); });
module.exports = React.createClass({ module.exports = React.createClass({
@ -662,16 +664,17 @@ module.exports = React.createClass({
userLevelsSection = <div>{ _t('No users have specific privileges in this room') }.</div>; userLevelsSection = <div>{ _t('No users have specific privileges in this room') }.</div>;
} }
var banned = this.props.room.getMembersWithMembership("ban"); const banned = this.props.room.getMembersWithMembership("ban");
var bannedUsersSection; let bannedUsersSection;
if (banned.length) { if (banned.length) {
bannedUsersSection = bannedUsersSection =
<div> <div>
<h3>{ _t('Banned users') }</h3> <h3>{ _t('Banned users') }</h3>
<ul className="mx_RoomSettings_banned"> <ul className="mx_RoomSettings_banned">
{banned.map(function(member) { {banned.map(function(member) {
const banEvent = member.events.member.getContent();
return ( return (
<BannedUser key={member.userId} member={member} /> <BannedUser key={member.userId} member={member} reason={banEvent.reason} />
); );
})} })}
</ul> </ul>