diff --git a/src/models/room.js b/src/models/room.js index 79a670dcf..cabfd77a3 100644 --- a/src/models/room.js +++ b/src/models/room.js @@ -866,6 +866,18 @@ Room.prototype.getCanonicalAlias = function() { return null; }; +/** + * Get this room's alternative aliases + * @return {[string]} The room's alternative aliases, or an empty array + */ +Room.prototype.getAltAliases = function() { + const canonicalAlias = this.currentState.getStateEvents("m.room.canonical_alias", ""); + if (canonicalAlias) { + return canonicalAlias.getContent().alt_aliases || []; + } + return []; +}; + /** * Add events to a timeline *