1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Merge pull request #1225 from matrix-org/bwindels/aliasautocomplete

Add room method for alt_aliases
This commit is contained in:
Bruno Windels
2020-02-24 12:17:45 +00:00
committed by GitHub

View File

@@ -861,11 +861,23 @@ Room.prototype.getAliases = function() {
Room.prototype.getCanonicalAlias = function() {
const canonicalAlias = this.currentState.getStateEvents("m.room.canonical_alias", "");
if (canonicalAlias) {
return canonicalAlias.getContent().alias;
return canonicalAlias.getContent().alias || null;
}
return null;
};
/**
* Get this room's alternative aliases
* @return {array} 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
*