Handle there being no member event when banned

Here, and also in MemberEventListSummary where this also broke.
pull/21833/head
David Baker 2017-02-17 16:35:18 +00:00
parent 1f5fdf7945
commit b18473ccb2
2 changed files with 5 additions and 3 deletions

View File

@ -381,7 +381,7 @@ module.exports = React.createClass({
// Initialise a user's events // Initialise a user's events
if (!userEvents[userId]) { if (!userEvents[userId]) {
userEvents[userId] = []; userEvents[userId] = [];
avatarMembers.push(e.target); if (e.target) avatarMembers.push(e.target);
} }
userEvents[userId].push({ userEvents[userId].push({
mxEvent: e, mxEvent: e,

View File

@ -143,9 +143,11 @@ module.exports = React.createClass({
} else if (kicked || banned) { } else if (kicked || banned) {
const verb = kicked ? 'kicked' : 'banned'; const verb = kicked ? 'kicked' : 'banned';
const roomName = this._roomNameElement('this room'); const roomName = this._roomNameElement('this room');
const kicker = this.props.room.currentState.getMember( const kickerMember = this.props.room.currentState.getMember(
myMember.events.member.getSender() myMember.events.member.getSender()
); );
const kickerName = kickerMember ?
kickerMember.name : myMember.events.member.getSender();
let reason; let reason;
if (myMember.events.member.getContent().reason) { if (myMember.events.member.getContent().reason) {
reason = <div>Reason: {myMember.events.member.getContent().reason}</div> reason = <div>Reason: {myMember.events.member.getContent().reason}</div>
@ -157,7 +159,7 @@ module.exports = React.createClass({
joinBlock = ( joinBlock = (
<div> <div>
<div className="mx_RoomPreviewBar_join_text"> <div className="mx_RoomPreviewBar_join_text">
You have been {verb} from {roomName} by {kicker.name}.<br /> You have been {verb} from {roomName} by {kickerName}.<br />
{reason} {reason}
{rejoinBlock} {rejoinBlock}
<a onClick={ this.props.onForgetClick }><b>Forget</b></a> <a onClick={ this.props.onForgetClick }><b>Forget</b></a>