Merge branch '584-room-details-shared-rooms' into 'dev'

Members dialog: show other room a person is with you

See merge request keanuapp/keanuapp-weblite!285
This commit is contained in:
N Pex 2024-03-18 13:58:58 +00:00
commit 4ab899433b
2 changed files with 31 additions and 3 deletions

View file

@ -324,7 +324,9 @@
"make_public": "Make Public",
"make_public_warning": "warning: Full message history will be visible to new participants",
"direct_link": "My Direct Link",
"direct_link_desc": "It's ready to share! A new direct room will open each time someone opens the link."
"direct_link_desc": "It's ready to share! A new direct room will open each time someone opens the link.",
"shared_room_number": "You share {count} rooms with {name}",
"shared_room_number_more": "You share more than {count} rooms with {name}"
},
"room_info_sheet": {
"this_room": "This room",

View file

@ -18,10 +18,10 @@
{{
activeMember.userId == $matrix.currentUserId
? $t("room_info.user_you", {
user: activeMember.user ? activeMember.user.displayName : activeMember.name,
user: activeMemberName(activeMember)
})
: $t("room_info.user", {
user: activeMember.user ? activeMember.user.displayName : activeMember.name,
user: activeMemberName(activeMember)
})
}}
</span>
@ -32,6 +32,11 @@
{{ $t("room_info.user_moderator") }}
</span>
</div>
<template v-if="activeMember.userId != $matrix.currentUserId && sharedRooms.length">
<span v-if="sharedRooms.length < 3">{{ $t("room_info.shared_room_number", {count: sharedRooms.length, name: activeMemberName(activeMember)}) }}</span>
<span v-else>{{ $t("room_info.shared_room_number_more", {count: sharedRooms.length, name: activeMemberName(activeMember)}) }}</span>
<p class="font-weight-light">{{ sharedRooms.slice(0, 3).join(", ") }}</p>
</template>
</div>
<DeviceList :member="activeMember" />
<div class="py-3" v-if="activeMember.userId != $matrix.currentUserId">
@ -83,6 +88,24 @@ export default {
showDialog: false
};
},
computed: {
joinedMembersByRoomId() {
const joinedRooms = this.$matrix.joinedRooms.filter(room => !this.$matrix.isDirectRoom(room)) || [];
return joinedRooms.map(room => ({
roomId: room.roomId,
roomName: room.name,
memberIds: room.getJoinedMembers().map(({ userId }) => userId)
}));
},
sharedRooms() {
return this.joinedMembersByRoomId.reduce((sharedRooms, room) => {
if (room.roomId !== this.room.roomId && room.memberIds.includes(this.activeMember.userId)) {
sharedRooms.push(room.roomName);
}
return sharedRooms;
}, []);
}
},
watch: {
show: {
handler(newVal, ignoredOldVal) {
@ -97,6 +120,9 @@ export default {
},
methods: {
activeMemberName(activeMember) {
return activeMember.user ? activeMember.user.displayName : activeMember.name
},
startPrivateChat(userId) {
this.$matrix
.getOrCreatePrivateChat(userId)