Merge pull request #1441 from turt2live/travis/who_banned

Show who banned the user on hover
This commit is contained in:
Luke Barnard 2017-10-11 17:33:53 +02:00 committed by GitHub
commit 8958be9321
3 changed files with 11 additions and 3 deletions

View file

@ -63,6 +63,7 @@ const BannedUser = React.createClass({
propTypes: { propTypes: {
canUnban: React.PropTypes.bool, canUnban: React.PropTypes.bool,
member: React.PropTypes.object.isRequired, // js-sdk RoomMember member: React.PropTypes.object.isRequired, // js-sdk RoomMember
by: React.PropTypes.string.isRequired,
reason: React.PropTypes.string, reason: React.PropTypes.string,
}, },
@ -101,8 +102,10 @@ const BannedUser = React.createClass({
return ( return (
<li> <li>
{ unbanButton } { unbanButton }
<strong>{this.props.member.name}</strong> {this.props.member.userId} <span title={_t("Banned by %(displayName)s", {displayName: this.props.by})}>
{this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : ""} <strong>{this.props.member.name}</strong> {this.props.member.userId}
{this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : ""}
</span>
</li> </li>
); );
}, },
@ -709,8 +712,11 @@ module.exports = React.createClass({
<ul className="mx_RoomSettings_banned"> <ul className="mx_RoomSettings_banned">
{banned.map(function(member) { {banned.map(function(member) {
const banEvent = member.events.member.getContent(); const banEvent = member.events.member.getContent();
const sender = self.props.room.getMember(member.events.member.getSender());
let bannedBy = member.events.member.getSender(); // start by falling back to mxid
if (sender) bannedBy = sender.name;
return ( return (
<BannedUser key={member.userId} canUnban={canBanUsers} member={member} reason={banEvent.reason} /> <BannedUser key={member.userId} canUnban={canBanUsers} member={member} reason={banEvent.reason} by={bannedBy} />
); );
})} })}
</ul> </ul>

View file

@ -801,6 +801,7 @@
"This will allow you to reset your password and receive notifications.": "This will allow you to reset your password and receive notifications.", "This will allow you to reset your password and receive notifications.": "This will allow you to reset your password and receive notifications.",
"To return to your account in future you need to set a password": "To return to your account in future you need to set a password", "To return to your account in future you need to set a password": "To return to your account in future you need to set a password",
"Skip": "Skip", "Skip": "Skip",
"Banned by %(displayName)s": "Banned by %(displayName)s",
"Start verification": "Start verification", "Start verification": "Start verification",
"Share without verifying": "Share without verifying", "Share without verifying": "Share without verifying",
"Ignore request": "Ignore request", "Ignore request": "Ignore request",

View file

@ -600,6 +600,7 @@
"Desktop specific": "Desktop specific", "Desktop specific": "Desktop specific",
"Analytics": "Analytics", "Analytics": "Analytics",
"Opt out of analytics": "Opt out of analytics", "Opt out of analytics": "Opt out of analytics",
"Banned by %(displayName)s": "Banned by %(displayName)s",
"Options": "Options", "Options": "Options",
"Riot collects anonymous analytics to allow us to improve the application.": "Riot collects anonymous analytics to allow us to improve the application.", "Riot collects anonymous analytics to allow us to improve the application.": "Riot collects anonymous analytics to allow us to improve the application.",
"Passphrases must match": "Passphrases must match", "Passphrases must match": "Passphrases must match",