From b18473ccb28b7da707580b6ae43f8e38be7aa540 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 17 Feb 2017 16:35:18 +0000 Subject: [PATCH] Handle there being no member event when banned Here, and also in MemberEventListSummary where this also broke. --- src/components/views/elements/MemberEventListSummary.js | 2 +- src/components/views/rooms/RoomPreviewBar.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/views/elements/MemberEventListSummary.js b/src/components/views/elements/MemberEventListSummary.js index 1a73b5a50e..510d861730 100644 --- a/src/components/views/elements/MemberEventListSummary.js +++ b/src/components/views/elements/MemberEventListSummary.js @@ -381,7 +381,7 @@ module.exports = React.createClass({ // Initialise a user's events if (!userEvents[userId]) { userEvents[userId] = []; - avatarMembers.push(e.target); + if (e.target) avatarMembers.push(e.target); } userEvents[userId].push({ mxEvent: e, diff --git a/src/components/views/rooms/RoomPreviewBar.js b/src/components/views/rooms/RoomPreviewBar.js index 3476c47f09..43c3b05295 100644 --- a/src/components/views/rooms/RoomPreviewBar.js +++ b/src/components/views/rooms/RoomPreviewBar.js @@ -143,9 +143,11 @@ module.exports = React.createClass({ } else if (kicked || banned) { const verb = kicked ? 'kicked' : 'banned'; const roomName = this._roomNameElement('this room'); - const kicker = this.props.room.currentState.getMember( + const kickerMember = this.props.room.currentState.getMember( myMember.events.member.getSender() ); + const kickerName = kickerMember ? + kickerMember.name : myMember.events.member.getSender(); let reason; if (myMember.events.member.getContent().reason) { reason =
Reason: {myMember.events.member.getContent().reason}
@@ -157,7 +159,7 @@ module.exports = React.createClass({ joinBlock = (
- You have been {verb} from {roomName} by {kicker.name}.
+ You have been {verb} from {roomName} by {kickerName}.
{reason} {rejoinBlock} Forget