Merge branch '564-make-sure-we-support-display-of-server-messages' into 'dev'

Recognize server notification room in room list

See merge request keanuapp/keanuapp-weblite!268
This commit is contained in:
N Pex 2023-11-22 15:36:52 +00:00
commit b14749c28f
2 changed files with 19 additions and 7 deletions

View file

@ -15,7 +15,7 @@
<!-- invites -->
<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-img v-if="roomAvatar(room)" :src="roomAvatar(room)" />
<span v-else class="white--text headline">{{
@ -29,12 +29,12 @@
<v-list-item-action>
<v-btn id="btn-accept" class="filled-button" depressed color="black" @click.stop="acceptInvitation(room)">{{
$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>
</v-list-item-action>
</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-img v-if="roomAvatar(room)" :src="roomAvatar(room)" />
<span v-else class="white--text headline">{{
@ -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
);

View file

@ -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();
},