diff --git a/src/domain/session/room/RoomViewModel.js b/src/domain/session/room/RoomViewModel.js index 1d2f3725..5d08f903 100644 --- a/src/domain/session/room/RoomViewModel.js +++ b/src/domain/session/room/RoomViewModel.js @@ -147,6 +147,14 @@ export class RoomViewModel extends ViewModel { forgetRoom() { this._room.forget(); } + + get canRejoin() { + return this._room.isArchived; + } + + rejoinRoom() { + this._room.join(); + } async _sendMessage(message) { if (!this._room.isArchived && message) { diff --git a/src/matrix/room/ArchivedRoom.js b/src/matrix/room/ArchivedRoom.js index a87bd774..f975191e 100644 --- a/src/matrix/room/ArchivedRoom.js +++ b/src/matrix/room/ArchivedRoom.js @@ -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) { diff --git a/src/platform/web/ui/session/room/RoomView.js b/src/platform/web/ui/session/room/RoomView.js index e2ef0de7..3d8c58a5 100644 --- a/src/platform/web/ui/session/room/RoomView.js +++ b/src/platform/web/ui/session/room/RoomView.js @@ -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; }