From 10b4c8ac35e5cc5b28689b4d4cc438f1a4aaea3d Mon Sep 17 00:00:00 2001 From: N-Pex Date: Thu, 19 Jun 2025 12:12:40 +0200 Subject: [PATCH] Fix delete room --- src/components/PurgeRoomDialog.vue | 59 +++++++++++++----------------- src/services/matrix.service.js | 12 +++--- 2 files changed, 30 insertions(+), 41 deletions(-) diff --git a/src/components/PurgeRoomDialog.vue b/src/components/PurgeRoomDialog.vue index 243dc1f..695cb78 100644 --- a/src/components/PurgeRoomDialog.vue +++ b/src/components/PurgeRoomDialog.vue @@ -7,16 +7,14 @@ scroll-strategy="none" >
- + $vuetify.icons.trash_black +

{{ $t("purge_room.title") }}

+
+ {{ $t("purge_room.info") }} +
+
+ {{ status }} +
@@ -48,18 +46,15 @@
- + $vuetify.icons.timer + {{ $t("purge_room.n_seconds", { seconds: timeout }) }} +

{{ $t("purge_room.self_destruct") }}

+
+ {{ $t("purge_room.notified") }} +
+
+ {{ status }} +
@@ -107,7 +102,7 @@ export default { }; }, methods: { - onOpenDialog() { + onOpenDialog() { // Showing, reset this.status = null; }, @@ -119,21 +114,17 @@ export default { this.timeout = -1; // Cancel the state event for deletion - this.$matrix.matrixClient.sendStateEvent( - this.room.roomId, - STATE_EVENT_ROOM_DELETION_NOTICE, - { status: "cancel" } - ); + this.$matrix.matrixClient.sendStateEvent(this.room.roomId, STATE_EVENT_ROOM_DELETION_NOTICE, { + status: "cancel", + }); this.showDialog = false; }, onPurgeRoom() { // Send custom state event! - this.$matrix.matrixClient.sendStateEvent( - this.room.roomId, - STATE_EVENT_ROOM_DELETION_NOTICE, - { status: "delete" } - ); + this.$matrix.matrixClient.sendStateEvent(this.room.roomId, STATE_EVENT_ROOM_DELETION_NOTICE, { + status: "delete", + }); this.timeout = 7; this.timeoutTimer = setInterval(() => { @@ -144,7 +135,7 @@ export default { }, 1000); }, onDoPurgeRoom() { - this.timeout = 0 + this.timeout = 0; clearInterval(this.timeoutTimer); this.timeoutTimer = null; this.isPurging = true; diff --git a/src/services/matrix.service.js b/src/services/matrix.service.js index 1c4acb5..cbff9e1 100644 --- a/src/services/matrix.service.js +++ b/src/services/matrix.service.js @@ -860,7 +860,6 @@ export default { }); }; - const oldGlobalErrorSetting = this.matrixClient.getGlobalErrorOnUnknownDevices(); return new Promise((resolve, reject) => { const room = this.getRoom(roomId); if (!room) { @@ -925,8 +924,6 @@ export default { .then(() => { //console.log("Purge: redact events"); statusCallback(this.$t("room.purge_redacting_events")); - // First ignore unknown device errors - this.matrixClient.setGlobalErrorOnUnknownDevices(false); const allEvents = timelineWindow.getEvents().filter((event) => { return ( !event.isRedacted() && @@ -1004,7 +1001,6 @@ export default { }) .then(() => { statusCallback(null); - this.matrixClient.setGlobalErrorOnUnknownDevices(oldGlobalErrorSetting); return withRetry(() => this.leaveRoom(roomId)); }) .then(() => { @@ -1014,7 +1010,6 @@ export default { .catch((err) => { console.error("Error purging room", err); this.currentRoomBeingPurged = false; - this.matrixClient.setGlobalErrorOnUnknownDevices(oldGlobalErrorSetting); reject(err); }); }); @@ -1363,13 +1358,16 @@ export default { }, render: () => {} }); + + const t = options.i18n.global.t; + matrixService.config.globalProperties.$store = store; matrixService.config.globalProperties.$config = app.$config; - matrixService.config.globalProperties.$t = app.$t; + matrixService.config.globalProperties.$t = t; matrixService.config.globalProperties.$navigation = app.$navigation; matrixService.$store = store; matrixService.$config = app.$config; - matrixService.$t = app.$t; + matrixService.$t = t; matrixService.$navigation = app.$navigation; const instance = matrixService.mount("#app2"); app.config.globalProperties.$matrix = instance;