From d1a24ac87b56d5fb7a1b2f28ea6189bcfc508227 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 2 Feb 2018 08:12:56 +0000 Subject: [PATCH] guard against m.room.aliases events with no keys (redaction?) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/room_settings/AliasSettings.js | 4 ++-- src/components/views/rooms/RoomSettings.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/views/room_settings/AliasSettings.js b/src/components/views/room_settings/AliasSettings.js index 2915a061de..bd92d75dd9 100644 --- a/src/components/views/room_settings/AliasSettings.js +++ b/src/components/views/room_settings/AliasSettings.js @@ -58,8 +58,8 @@ module.exports = React.createClass({ state.domainToAliases = this.aliasEventsToDictionary(aliasEvents); - state.remoteDomains = Object.keys(state.domainToAliases).filter((alias) => { - return alias !== localDomain; + state.remoteDomains = Object.keys(state.domainToAliases).filter((domain) => { + return domain !== localDomain && state.domainToAliases[domain].length > 0; }); if (canonicalAliasEvent) { diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 0bbf33478d..ea4a29615e 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -774,7 +774,8 @@ module.exports = React.createClass({ const aliasEvents = this.props.room.currentState.getStateEvents('m.room.aliases') || []; let aliasCount = 0; aliasEvents.forEach((event) => { - aliasCount += event.getContent().aliases.length; + const aliases = event.getContent().aliases || []; + aliasCount += aliases.length; }); if (this.state.join_rule === "public" && aliasCount == 0) {