mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
notification subscription
This commit is contained in:
parent
9e52ec5469
commit
1b8b356432
@ -7,8 +7,8 @@ export default {
|
|||||||
notificationAdded: {
|
notificationAdded: {
|
||||||
subscribe: withFilter(
|
subscribe: withFilter(
|
||||||
() => pubsub.asyncIterator(NOTIFICATION_ADDED),
|
() => pubsub.asyncIterator(NOTIFICATION_ADDED),
|
||||||
(payload, variables) => {
|
(payload, variables, context) => {
|
||||||
return payload.notificationAdded.to.id === variables.userId
|
return payload.notificationAdded.to.id === context.user?.id
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -38,5 +38,5 @@ type Mutation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Subscription {
|
type Subscription {
|
||||||
notificationAdded(userId: ID!): NOTIFIED
|
notificationAdded: NOTIFIED
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,11 +137,6 @@ export default {
|
|||||||
},
|
},
|
||||||
subscribeToMore: {
|
subscribeToMore: {
|
||||||
document: notificationAdded(),
|
document: notificationAdded(),
|
||||||
variables() {
|
|
||||||
return {
|
|
||||||
userId: this.user.id,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
updateQuery: (previousResult, { subscriptionData }) => {
|
updateQuery: (previousResult, { subscriptionData }) => {
|
||||||
const {
|
const {
|
||||||
data: { notificationAdded: newNotification },
|
data: { notificationAdded: newNotification },
|
||||||
|
|||||||
@ -245,8 +245,8 @@ export const notificationAdded = () => {
|
|||||||
${postFragment}
|
${postFragment}
|
||||||
${groupFragment}
|
${groupFragment}
|
||||||
|
|
||||||
subscription notifications($userId: ID!) {
|
subscription notifications {
|
||||||
notificationAdded(userId: $userId) {
|
notificationAdded {
|
||||||
id
|
id
|
||||||
read
|
read
|
||||||
reason
|
reason
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user