diff --git a/backend/src/schema/resolvers/rooms.ts b/backend/src/schema/resolvers/rooms.ts index 2fe621d23..02309e172 100644 --- a/backend/src/schema/resolvers/rooms.ts +++ b/backend/src/schema/resolvers/rooms.ts @@ -12,7 +12,11 @@ export default { if (resolved) { resolved.forEach((room) => { if (room.users) { + // buggy, you must query the username for this to function correctly room.roomName = room.users.filter((user) => user.id !== context.user.id)[0].name + room.avatar = + room.users.filter((user) => user.id !== context.user.id)[0].avatar?.url || + 'default-avatar' room.users.forEach((user) => { user._id = user.id }) diff --git a/backend/src/schema/types/type/Room.gql b/backend/src/schema/types/type/Room.gql index c90ebda3a..2ce6556f6 100644 --- a/backend/src/schema/types/type/Room.gql +++ b/backend/src/schema/types/type/Room.gql @@ -14,6 +14,7 @@ type Room { roomId: String! @cypher(statement: "RETURN this.id") roomName: String! ## @cypher(statement: "MATCH (this)<-[:CHATS_IN]-(user:User) WHERE NOT user.id = $cypherParams.currentUserId RETURN user[0].name") + avatar: String! ## @cypher match not own user in users array } type Mutation { diff --git a/webapp/components/Chat/Chat.vue b/webapp/components/Chat/Chat.vue index c2b02c0af..9cd3e391a 100644 --- a/webapp/components/Chat/Chat.vue +++ b/webapp/components/Chat/Chat.vue @@ -27,7 +27,7 @@