Show who banned the user on hover

Fixes https://github.com/vector-im/riot-web/issues/5039

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-09-29 16:04:12 -06:00
parent ffb9dd844a
commit d1fdd20809
3 changed files with 9 additions and 3 deletions

View file

@ -39,6 +39,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.object.isRequired, // js-sdk RoomMember
reason: React.PropTypes.string, reason: React.PropTypes.string,
}, },
@ -77,8 +78,10 @@ const BannedUser = React.createClass({
return ( return (
<li> <li>
{ unbanButton } { unbanButton }
<span title={_t("Banned by %(displayName)s (%(userId)s)", {displayName: this.props.by.name, userId: this.props.by.userId})}>
<strong>{this.props.member.name}</strong> {this.props.member.userId} <strong>{this.props.member.name}</strong> {this.props.member.userId}
{this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : ""} {this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : ""}
</span>
</li> </li>
); );
}, },
@ -670,8 +673,9 @@ 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 bannedBy = self.props.room.getMember(member.events.member.getSender());
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

@ -808,6 +808,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 (%(userId)s)": "Banned by %(displayName)s (%(userId)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

@ -607,6 +607,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 (%(userId)s)": "Banned by %(displayName)s (%(userId)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",