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

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

View file

@ -162,6 +162,12 @@ export class ArchivedRoom extends BaseRoom {
this._forgetCallback(this.id); 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) { function findKickDetails(roomResponse, ownUserId) {

View file

@ -73,6 +73,9 @@ export class RoomView extends TemplateView {
if (vm.canForget) { if (vm.canForget) {
options.push(Menu.option(vm.i18n`Forget room`, () => vm.forgetRoom())); 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) { if (!options.length) {
return; return;
} }