Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #213 from matrix-org/dbkr/redacted_3pid_invite_crash
Browse files Browse the repository at this point in the history
Don't crash on redacted (or otherwise invalid) 3pid invites
  • Loading branch information
dbkr committed Mar 11, 2016
2 parents fc06207 + 1131b82 commit e0c416e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/views/rooms/MemberList.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ module.exports = React.createClass({
);
});

// XXX: surely this is not the right home for this logic.
if (membership === "invite") {
// include 3pid invites (m.room.third_party_invite) state events.
// The HS may have already converted these into m.room.member invites so
Expand All @@ -358,6 +359,12 @@ module.exports = React.createClass({
if (room) {
room.currentState.getStateEvents("m.room.third_party_invite").forEach(
function(e) {
// any events without these keys are not valid 3pid invites, so we ignore them
var required_keys = ['key_validity_url', 'public_key', 'display_name'];
for (var i = 0; i < required_keys.length; ++i) {
if (e.getContent()[required_keys[i]] === undefined) return;
}

// discard all invites which have a m.room.member event since we've
// already added them.
var memberEvent = room.currentState.getInviteForThreePidToken(e.getStateKey());
Expand Down

0 comments on commit e0c416e

Please sign in to comment.