Fallback to MXID instead of relying on the user being in the room

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-10-11 09:05:54 -06:00
parent d1fdd20809
commit 8a2813ac08
3 changed files with 7 additions and 5 deletions

View file

@ -39,7 +39,7 @@ const BannedUser = React.createClass({
propTypes: {
canUnban: React.PropTypes.bool,
member: React.PropTypes.object.isRequired, // js-sdk RoomMember
by: React.PropTypes.object.isRequired, // js-sdk RoomMember
by: React.PropTypes.string.isRequired,
reason: React.PropTypes.string,
},
@ -78,7 +78,7 @@ const BannedUser = React.createClass({
return (
<li>
{ unbanButton }
<span title={_t("Banned by %(displayName)s (%(userId)s)", {displayName: this.props.by.name, userId: this.props.by.userId})}>
<span title={_t("Banned by %(displayName)s", {displayName: this.props.by})}>
<strong>{this.props.member.name}</strong> {this.props.member.userId}
{this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : ""}
</span>
@ -673,7 +673,9 @@ module.exports = React.createClass({
<ul className="mx_RoomSettings_banned">
{banned.map(function(member) {
const banEvent = member.events.member.getContent();
const bannedBy = self.props.room.getMember(member.events.member.getSender());
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 (
<BannedUser key={member.userId} canUnban={canBanUsers} member={member} reason={banEvent.reason} by={bannedBy} />
);

View file

@ -808,7 +808,7 @@
"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",
"Skip": "Skip",
"Banned by %(displayName)s (%(userId)s)": "Banned by %(displayName)s (%(userId)s)",
"Banned by %(displayName)s": "Banned by %(displayName)s",
"Start verification": "Start verification",
"Share without verifying": "Share without verifying",
"Ignore request": "Ignore request",

View file

@ -607,7 +607,7 @@
"Desktop specific": "Desktop specific",
"Analytics": "Analytics",
"Opt out of analytics": "Opt out of analytics",
"Banned by %(displayName)s (%(userId)s)": "Banned by %(displayName)s (%(userId)s)",
"Banned by %(displayName)s": "Banned by %(displayName)s",
"Options": "Options",
"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",