Skip to content

Commit 711bf58

Browse files
committed
missed a file
1 parent 2771907 commit 711bf58

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎src/MatrixTools.js‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var MatrixClientPeg = require('./MatrixClientPeg');
2+
3+
module.exports = {
4+
/**
5+
* Given a room object, return the canonical alias for it
6+
* if there is one. Otherwise return null;
7+
*/
8+
getCanonicalAliasForRoom: function(room) {
9+
var aliasEvents = room.currentState.getStateEvents(
10+
"m.room.aliases"
11+
);
12+
// Canonical aliases aren't implemented yet, so just return the first
13+
for (var j = 0; j < aliasEvents.length; j++) {
14+
var aliases = aliasEvents[j].getContent().aliases;
15+
if (aliases && aliases.length) {
16+
return aliases[0];
17+
}
18+
}
19+
return null;
20+
}
21+
}
22+

0 commit comments

Comments
 (0)