From d1fdd208097142b9bfdbbf2fc115b271af2bf2bf Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 29 Sep 2017 16:04:12 -0600 Subject: [PATCH 1/2] Show who banned the user on hover Fixes https://github.com/vector-im/riot-web/issues/5039 Signed-off-by: Travis Ralston --- src/components/views/rooms/RoomSettings.js | 10 +++++++--- src/i18n/strings/en_EN.json | 1 + src/i18n/strings/en_US.json | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 031e089c4e..05116bc097 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -39,6 +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 reason: React.PropTypes.string, }, @@ -77,8 +78,10 @@ const BannedUser = React.createClass({ return (
  • { unbanButton } - {this.props.member.name} {this.props.member.userId} - {this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : ""} + + {this.props.member.name} {this.props.member.userId} + {this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : ""} +
  • ); }, @@ -670,8 +673,9 @@ module.exports = React.createClass({ diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index cf2be3c2f8..9e5524d80c 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -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.", "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)", "Start verification": "Start verification", "Share without verifying": "Share without verifying", "Ignore request": "Ignore request", diff --git a/src/i18n/strings/en_US.json b/src/i18n/strings/en_US.json index 3954b2b6fa..93b3e88332 100644 --- a/src/i18n/strings/en_US.json +++ b/src/i18n/strings/en_US.json @@ -607,6 +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)", "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", From 8a2813ac08e212fef2aa62b14ff7d800f7ab2923 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 11 Oct 2017 09:05:54 -0600 Subject: [PATCH 2/2] Fallback to MXID instead of relying on the user being in the room Signed-off-by: Travis Ralston --- src/components/views/rooms/RoomSettings.js | 8 +++++--- src/i18n/strings/en_EN.json | 2 +- src/i18n/strings/en_US.json | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 05116bc097..b62b72bf18 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -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 (
  • { unbanButton } - + {this.props.member.name} {this.props.member.userId} {this.props.reason ? " " +_t('Reason') + ": " + this.props.reason : ""} @@ -673,7 +673,9 @@ module.exports = React.createClass({
      {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 ( ); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 9e5524d80c..f6edae19a9 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -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", diff --git a/src/i18n/strings/en_US.json b/src/i18n/strings/en_US.json index 93b3e88332..fccf387f30 100644 --- a/src/i18n/strings/en_US.json +++ b/src/i18n/strings/en_US.json @@ -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",