forked from mystiq/hydrogen-web
allow to join room by id or alias
This commit is contained in:
parent
a4d3b5f013
commit
9679058081
2 changed files with 11 additions and 0 deletions
|
@ -717,6 +717,13 @@ export class Session {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
joinRoom(roomIdOrAlias, log = null) {
|
||||||
|
return this._platform.logger.wrapOrRun(log, "joinRoom", async log => {
|
||||||
|
const body = await this._hsApi.joinIdOrAlias(roomIdOrAlias).response();
|
||||||
|
return body.room_id;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function tests() {
|
export function tests() {
|
||||||
|
|
|
@ -190,6 +190,10 @@ export class HomeServerApi {
|
||||||
return this._post(`/rooms/${encodeURIComponent(roomId)}/join`, null, null, options);
|
return this._post(`/rooms/${encodeURIComponent(roomId)}/join`, null, null, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
joinIdOrAlias(roomIdOrAlias, options = null) {
|
||||||
|
return this._post(`/join/${encodeURIComponent(roomIdOrAlias)}`, null, null, options);
|
||||||
|
}
|
||||||
|
|
||||||
leave(roomId, options = null) {
|
leave(roomId, options = null) {
|
||||||
return this._post(`/rooms/${encodeURIComponent(roomId)}/leave`, null, null, options);
|
return this._post(`/rooms/${encodeURIComponent(roomId)}/leave`, null, null, options);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue