Merge pull request #1072 from Half-Shot/hs/roomsettingsbanreason

Add reason for ban in room settings
This commit is contained in:
Matthew Hodgson 2017-06-11 20:45:00 +01:00 committed by GitHub
commit 203cdef8a5

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.member.userId}
{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>