From 7029ab07fc23f1b2da5d25324fdcb7addafb728e Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 25 Oct 2017 12:37:27 +0100 Subject: [PATCH] If no canonical alias, use first alias (and fallback to Unnamed) --- src/components/views/dialogs/AddressPickerDialog.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/views/dialogs/AddressPickerDialog.js b/src/components/views/dialogs/AddressPickerDialog.js index 8c6f033bdc..0a33e81677 100644 --- a/src/components/views/dialogs/AddressPickerDialog.js +++ b/src/components/views/dialogs/AddressPickerDialog.js @@ -282,10 +282,15 @@ module.exports = React.createClass({ } const avatarEvent = room.currentState.getStateEvents('m.room.avatar', ''); const avatarUrl = avatarEvent ? avatarEvent.getContent().url : undefined; + const aliasEvents = room.currentState.getStateEvents('m.room.aliases'); + const aliases = aliasEvents.map((ev) => ev.getContent().aliases).reduce((a, b) => { + return a.concat(b); + }, []); + results.push({ room_id: room.roomId, avatar_url: avatarUrl, - name: name || canonicalAlias, + name: name || canonicalAlias || aliases[0] || _t('Unnamed Room'), }); }); this._processResults(results, query);