From c6fcdb4fe595bf64e66ad01a115bb447c19fca86 Mon Sep 17 00:00:00 2001 From: N-Pex Date: Fri, 17 Nov 2023 11:23:04 +0100 Subject: [PATCH] Recognize server notification room in room list Remove the "ignore" button, service notification room invites can't be rejected. --- src/components/RoomList.vue | 15 +++++++++------ src/services/matrix.service.js | 11 ++++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/components/RoomList.vue b/src/components/RoomList.vue index e1452c4..8e01b44 100644 --- a/src/components/RoomList.vue +++ b/src/components/RoomList.vue @@ -15,7 +15,7 @@ + :value="room" class="room-list-room"> {{ @@ -29,12 +29,12 @@ {{ $t("menu.join") }} - {{ + {{ $t("menu.ignore") }} - + {{ @@ -181,16 +181,19 @@ export default { return this.$matrix.isDirectRoom(room); }, - roomChange(roomId) { - if (roomId == null || roomId == undefined) { + roomChange(room) { + if (room == null || room == undefined) { // Ignore, this is caused by "new room" etc. return; } + if (room.isServiceNoticeRoom && room.selfMembership === "invite") { + return; // Nothing should happen when click on invite to server notices room, just the "join" button is enabled. + } this.$emit("close"); this.$navigation.push( { name: "Chat", - params: { roomId: util.sanitizeRoomId(roomId) }, + params: { roomId: util.sanitizeRoomId(room.roomId) }, }, -1 ); diff --git a/src/services/matrix.service.js b/src/services/matrix.service.js index 09250d6..f342881 100644 --- a/src/services/matrix.service.js +++ b/src/services/matrix.service.js @@ -404,7 +404,16 @@ export default { this.updateNotificationCount(); }, - onRoom(ignoredroom) { + onRoom(room) { + if (room.selfMembership === "invite") { + this.matrixClient.getRoomTags(room.roomId).then(reply => { + if (Object.keys(reply.tags).includes("m.server_notice")) { + Vue.set(room, "isServiceNoticeRoom", true); + } + }).catch((error => { + console.error(error); + })) + } this.reloadRooms(); this.updateNotificationCount(); },