mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
missed a file
This commit is contained in:
parent
2771907573
commit
711bf583ab
22
src/MatrixTools.js
Normal file
22
src/MatrixTools.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
var MatrixClientPeg = require('./MatrixClientPeg');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
/**
|
||||||
|
* Given a room object, return the canonical alias for it
|
||||||
|
* if there is one. Otherwise return null;
|
||||||
|
*/
|
||||||
|
getCanonicalAliasForRoom: function(room) {
|
||||||
|
var aliasEvents = room.currentState.getStateEvents(
|
||||||
|
"m.room.aliases"
|
||||||
|
);
|
||||||
|
// Canonical aliases aren't implemented yet, so just return the first
|
||||||
|
for (var j = 0; j < aliasEvents.length; j++) {
|
||||||
|
var aliases = aliasEvents[j].getContent().aliases;
|
||||||
|
if (aliases && aliases.length) {
|
||||||
|
return aliases[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user