diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index fff7b97624..36ee4b8733 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -994,7 +994,8 @@ module.exports = React.createClass({ } var myUserId = MatrixClientPeg.get().credentials.userId; - if (this.state.room.currentState.members[myUserId].membership == 'invite') { + var myMember = this.state.room.getMember(myUserId); + if (myMember && myMember.membership == 'invite') { if (this.state.joining || this.state.rejecting) { var Loader = sdk.getComponent("elements.Spinner"); return ( @@ -1003,7 +1004,8 @@ module.exports = React.createClass({ ); } else { - var inviteEvent = this.state.room.currentState.members[myUserId].events.member.event; + var inviteEvent = myMember.events.member; + var inviterName = inviteEvent.sender ? inviteEvent.sender.name : inviteEvent.getSender(); // XXX: Leaving this intentionally basic for now because invites are about to change totally var joinErrorText = this.state.joinError ? "Failed to join room!" : ""; var rejectErrorText = this.state.rejectError ? "Failed to reject invite!" : ""; @@ -1011,7 +1013,7 @@ module.exports = React.createClass({
-
{inviteEvent.user_id} has invited you to a room
+
{inviterName} has invited you to a room