mirror of
https://github.com/element-hq/element-web
synced 2024-11-25 10:45:51 +03:00
If no canonical alias, use first alias (and fallback to Unnamed)
This commit is contained in:
parent
37b55984ec
commit
7029ab07fc
1 changed files with 6 additions and 1 deletions
|
@ -282,10 +282,15 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
const avatarEvent = room.currentState.getStateEvents('m.room.avatar', '');
|
const avatarEvent = room.currentState.getStateEvents('m.room.avatar', '');
|
||||||
const avatarUrl = avatarEvent ? avatarEvent.getContent().url : undefined;
|
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({
|
results.push({
|
||||||
room_id: room.roomId,
|
room_id: room.roomId,
|
||||||
avatar_url: avatarUrl,
|
avatar_url: avatarUrl,
|
||||||
name: name || canonicalAlias,
|
name: name || canonicalAlias || aliases[0] || _t('Unnamed Room'),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this._processResults(results, query);
|
this._processResults(results, query);
|
||||||
|
|
Loading…
Reference in a new issue