offer to rejoin archived room from menu

This commit is contained in:
Bruno Windels 2021-05-18 11:07:46 +02:00
parent 03be63572d
commit c04a8140a3
3 changed files with 17 additions and 0 deletions

View File

@ -148,6 +148,14 @@ export class RoomViewModel extends ViewModel {
this._room.forget();
}
get canRejoin() {
return this._room.isArchived;
}
rejoinRoom() {
this._room.join();
}
async _sendMessage(message) {
if (!this._room.isArchived && message) {
try {

View File

@ -162,6 +162,12 @@ export class ArchivedRoom extends BaseRoom {
this._forgetCallback(this.id);
});
}
join(log = null) {
return this._platform.logger.wrapOrRun(log, "rejoin archived room", async log => {
await this._hsApi.join(this.id, {log}).response();
});
}
}
function findKickDetails(roomResponse, ownUserId) {

View File

@ -73,6 +73,9 @@ export class RoomView extends TemplateView {
if (vm.canForget) {
options.push(Menu.option(vm.i18n`Forget room`, () => vm.forgetRoom()));
}
if (vm.canRejoin) {
options.push(Menu.option(vm.i18n`Rejoin room`, () => vm.rejoinRoom()));
}
if (!options.length) {
return;
}