mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
subscription chatMessageAdded security fix
This commit is contained in:
parent
1b8b356432
commit
f7c381efd8
@ -25,8 +25,8 @@ export default {
|
||||
chatMessageAdded: {
|
||||
subscribe: withFilter(
|
||||
() => pubsub.asyncIterator(CHAT_MESSAGE_ADDED),
|
||||
(payload, variables) => {
|
||||
return payload.userId === variables.userId
|
||||
(payload, variables, context) => {
|
||||
return payload.userId === context.user?.id
|
||||
},
|
||||
),
|
||||
},
|
||||
|
||||
@ -46,5 +46,5 @@ type Query {
|
||||
}
|
||||
|
||||
type Subscription {
|
||||
chatMessageAdded(userId: ID!): Message
|
||||
chatMessageAdded: Message
|
||||
}
|
||||
|
||||
@ -195,9 +195,6 @@ export default {
|
||||
// Subscriptions
|
||||
const observer = this.$apollo.subscribe({
|
||||
query: chatMessageAdded(),
|
||||
variables: {
|
||||
userId: this.currentUser.id,
|
||||
},
|
||||
})
|
||||
|
||||
observer.subscribe({
|
||||
|
||||
@ -54,8 +54,8 @@ export const messageQuery = () => {
|
||||
|
||||
export const chatMessageAdded = () => {
|
||||
return gql`
|
||||
subscription chatMessageAdded($userId: ID!) {
|
||||
chatMessageAdded(userId: $userId) {
|
||||
subscription chatMessageAdded {
|
||||
chatMessageAdded {
|
||||
_id
|
||||
id
|
||||
indexId
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user