Recognize server notification room in room list

Remove the "ignore" button, service notification room invites can't be rejected.
This commit is contained in:
N-Pex 2023-11-17 11:23:04 +01:00
parent 20dcf3668a
commit c6fcdb4fe5
2 changed files with 19 additions and 7 deletions

View file

@ -15,7 +15,7 @@
<!-- invites --> <!-- invites -->
<v-list-item :disabled="roomsProcessing[room.roomId]" v-for="room in invitedRooms" :key="room.roomId" <v-list-item :disabled="roomsProcessing[room.roomId]" v-for="room in invitedRooms" :key="room.roomId"
:value="room.roomId" class="room-list-room"> :value="room" class="room-list-room">
<v-list-item-avatar size="42" color="#d9d9d9"> <v-list-item-avatar size="42" color="#d9d9d9">
<v-img v-if="roomAvatar(room)" :src="roomAvatar(room)" /> <v-img v-if="roomAvatar(room)" :src="roomAvatar(room)" />
<span v-else class="white--text headline">{{ <span v-else class="white--text headline">{{
@ -29,12 +29,12 @@
<v-list-item-action> <v-list-item-action>
<v-btn id="btn-accept" class="filled-button" depressed color="black" @click.stop="acceptInvitation(room)">{{ <v-btn id="btn-accept" class="filled-button" depressed color="black" @click.stop="acceptInvitation(room)">{{
$t("menu.join") }}</v-btn> $t("menu.join") }}</v-btn>
<v-btn id="btn-reject" class="filled-button" color="black" @click.stop="rejectInvitation(room)" text>{{ <v-btn v-if="!room.isServiceNoticeRoom" id="btn-reject" class="filled-button" color="black" @click.stop="rejectInvitation(room)" text>{{
$t("menu.ignore") }}</v-btn> $t("menu.ignore") }}</v-btn>
</v-list-item-action> </v-list-item-action>
</v-list-item> </v-list-item>
<v-list-item v-for="room in joinedRooms" :key="room.roomId" :value="room.roomId" class="room-list-room"> <v-list-item v-for="room in joinedRooms" :key="room.roomId" :value="room" class="room-list-room">
<v-list-item-avatar size="42" color="#d9d9d9" :class="[{'rounded-circle': isDirect(room)}]"> <v-list-item-avatar size="42" color="#d9d9d9" :class="[{'rounded-circle': isDirect(room)}]">
<v-img v-if="roomAvatar(room)" :src="roomAvatar(room)" /> <v-img v-if="roomAvatar(room)" :src="roomAvatar(room)" />
<span v-else class="white--text headline">{{ <span v-else class="white--text headline">{{
@ -181,16 +181,19 @@ export default {
return this.$matrix.isDirectRoom(room); return this.$matrix.isDirectRoom(room);
}, },
roomChange(roomId) { roomChange(room) {
if (roomId == null || roomId == undefined) { if (room == null || room == undefined) {
// Ignore, this is caused by "new room" etc. // Ignore, this is caused by "new room" etc.
return; 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.$emit("close");
this.$navigation.push( this.$navigation.push(
{ {
name: "Chat", name: "Chat",
params: { roomId: util.sanitizeRoomId(roomId) }, params: { roomId: util.sanitizeRoomId(room.roomId) },
}, },
-1 -1
); );

View file

@ -404,7 +404,16 @@ export default {
this.updateNotificationCount(); 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.reloadRooms();
this.updateNotificationCount(); this.updateNotificationCount();
}, },