diff --git a/backend/src/schema/resolvers/rooms.ts b/backend/src/schema/resolvers/rooms.ts index 5e931a446..5382c5ee7 100644 --- a/backend/src/schema/resolvers/rooms.ts +++ b/backend/src/schema/resolvers/rooms.ts @@ -20,8 +20,8 @@ export default { roomCountUpdated: { subscribe: withFilter( () => pubsub.asyncIterator(ROOM_COUNT_UPDATED), - (payload, variables) => { - return payload.userId === variables.userId + (payload, variables, context) => { + return payload.userId === context.user?.id }, ), }, diff --git a/backend/src/schema/types/type/Room.gql b/backend/src/schema/types/type/Room.gql index 0cf5b22c8..221df8299 100644 --- a/backend/src/schema/types/type/Room.gql +++ b/backend/src/schema/types/type/Room.gql @@ -57,5 +57,5 @@ type Query { } type Subscription { - roomCountUpdated(userId: ID!): Int + roomCountUpdated: Int } diff --git a/webapp/components/ChatNotificationMenu/ChatNotificationMenu.vue b/webapp/components/ChatNotificationMenu/ChatNotificationMenu.vue index ec3f9fbc7..dd36b965a 100644 --- a/webapp/components/ChatNotificationMenu/ChatNotificationMenu.vue +++ b/webapp/components/ChatNotificationMenu/ChatNotificationMenu.vue @@ -44,11 +44,6 @@ export default { }, subscribeToMore: { document: roomCountUpdated(), - variables() { - return { - userId: this.user.id, - } - }, updateQuery: (previousResult, { subscriptionData }) => { return { UnreadRooms: subscriptionData.data.roomCountUpdated } }, diff --git a/webapp/graphql/Rooms.js b/webapp/graphql/Rooms.js index 757a6cfa4..577eb8eff 100644 --- a/webapp/graphql/Rooms.js +++ b/webapp/graphql/Rooms.js @@ -52,8 +52,8 @@ export const unreadRoomsQuery = () => { export const roomCountUpdated = () => { return gql` - subscription roomCountUpdated($userId: ID!) { - roomCountUpdated(userId: $userId) + subscription roomCountUpdated { + roomCountUpdated } ` }