diff --git a/webapp/components/Chat/AddChatRoomByUserSearch.vue b/webapp/components/Chat/AddChatRoomByUserSearch.vue index 425855b44..13e5d57c6 100644 --- a/webapp/components/Chat/AddChatRoomByUserSearch.vue +++ b/webapp/components/Chat/AddChatRoomByUserSearch.vue @@ -43,7 +43,12 @@
- {{ option.name }} + + {{ option.name }} {{ option.__typename === 'Group' ? `&${option.slug}` : `@${option.slug}` }} diff --git a/webapp/components/Chat/Chat.spec.js b/webapp/components/Chat/Chat.spec.js index 6733770af..a83e7ac5b 100644 --- a/webapp/components/Chat/Chat.spec.js +++ b/webapp/components/Chat/Chat.spec.js @@ -1129,7 +1129,9 @@ describe('Chat.vue', () => { it('replaces rooms instead of appending', async () => { wrapper = Wrapper() wrapper.vm.rooms = [mockRoom({ id: 'old', roomId: 'old' })] - mocks.$apollo.query.mockResolvedValue({ data: { Room: [mockRoom({ id: 'new', roomId: 'new' })] } }) + mocks.$apollo.query.mockResolvedValue({ + data: { Room: [mockRoom({ id: 'new', roomId: 'new' })] }, + }) await wrapper.vm.fetchRooms({ replace: true }) expect(wrapper.vm.rooms).toHaveLength(1) expect(wrapper.vm.rooms[0].id).toBe('new') diff --git a/webapp/components/Chat/Chat.vue b/webapp/components/Chat/Chat.vue index 64cccec6a..d2d0d5f57 100644 --- a/webapp/components/Chat/Chat.vue +++ b/webapp/components/Chat/Chat.vue @@ -71,7 +71,11 @@
- +
- - + + {{ selectedRoom ? selectedRoom.roomName : '' }}
-
+
{{ room.roomName }} @@ -110,7 +127,7 @@ :key="'avatar-' + msg._id" :profile="messageUserProfile(msg.senderId)" class="vac-message-avatar" - style="align-self: flex-end; margin: 0 0 2px; cursor: pointer;" + style="align-self: flex-end; margin: 0 0 2px; cursor: pointer" @click.native="navigateToUserProfile(msg.senderId)" /> @@ -262,7 +279,9 @@ export default { }, selectedRoomProfile() { if (!this.selectedRoom) return null - return this.selectedRoom.isGroupRoom ? this.selectedRoom.groupProfile : this.selectedRoom.userProfile + return this.selectedRoom.isGroupRoom + ? this.selectedRoom.groupProfile + : this.selectedRoom.userProfile }, roomHeaderLink() { if (!this.selectedRoom) return null @@ -785,7 +804,8 @@ export default { saved: true, _rawDate: new Date().toISOString(), _originalAvatar: - this.selectedRoom?.users?.find((u) => u.id === this.currentUser.id)?.avatar || this.initialsAvatarUrl(this.currentUser.name), + this.selectedRoom?.users?.find((u) => u.id === this.currentUser.id)?.avatar || + this.initialsAvatarUrl(this.currentUser.name), senderId: this.currentUser.id, files: messageDetails.files?.map((file) => ({ @@ -926,7 +946,9 @@ export default { async fetchServerRoom(variables) { try { - const { data: { Room } } = await this.$apollo.query({ + const { + data: { Room }, + } = await this.$apollo.query({ query: roomQuery(), variables, fetchPolicy: 'no-cache', @@ -971,7 +993,11 @@ export default { if (await this.fetchServerRoom({ userId })) return // Create a virtual room (no backend call — room is created on first message) - const currentUserProfile = { id: this.currentUser.id, name: this.currentUser.name, avatar: this.currentUser.avatar } + const currentUserProfile = { + id: this.currentUser.id, + name: this.currentUser.name, + avatar: this.currentUser.avatar, + } const otherUserProfile = { id: userId, name: userName, avatar: userAvatarObj } const virtualRoom = { id: `temp-${userId}`, @@ -1009,7 +1035,9 @@ export default { if (await this.fetchServerRoom({ groupId })) return try { - const { data: { CreateGroupRoom } } = await this.$apollo.mutate({ + const { + data: { CreateGroupRoom }, + } = await this.$apollo.mutate({ mutation: createGroupRoom(), variables: { groupId }, }) diff --git a/webapp/graphql/Rooms.js b/webapp/graphql/Rooms.js index d4c3968ca..b5e5fdf75 100644 --- a/webapp/graphql/Rooms.js +++ b/webapp/graphql/Rooms.js @@ -38,7 +38,14 @@ export const roomQuery = () => gql` ${imageUrls} query Room($first: Int, $before: String, $id: ID, $userId: ID, $groupId: ID, $search: String) { - Room(first: $first, before: $before, id: $id, userId: $userId, groupId: $groupId, search: $search) { + Room( + first: $first + before: $before + id: $id + userId: $userId + groupId: $groupId + search: $search + ) { id roomId roomName