Add via param in join room function

Signed-off-by: ajbura <ajbura@gmail.com>
This commit is contained in:
ajbura 2022-02-16 19:54:21 +05:30
parent 189dc93a6e
commit e654226e60

View file

@ -82,12 +82,15 @@ function guessDMRoomTargetId(room, myUserId) {
*
* @param {string} roomId
* @param {boolean} isDM
* @param {string[]} via
*/
async function join(roomIdOrAlias, isDM) {
async function join(roomIdOrAlias, isDM, via) {
const mx = initMatrix.matrixClient;
const roomIdParts = roomIdOrAlias.split(':');
const viaServers = via || [roomIdParts[1]];
try {
const resultRoom = await mx.joinRoom(roomIdOrAlias, { viaServers: [roomIdParts[1]] });
const resultRoom = await mx.joinRoom(roomIdOrAlias, { viaServers });
if (isDM) {
const targetUserId = guessDMRoomTargetId(mx.getRoom(resultRoom.roomId), mx.getUserId());