mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Clean up
- remove the code for subscriptions to Post as we won't implement this at this time... I've created a new branch with the code that can be built on later - remove unused subscription path - add possibility to use websockets uri for production env.
This commit is contained in:
parent
1c6a5503db
commit
6cf067937d
@ -49,7 +49,6 @@ export const serverConfigs = {
|
||||
CLIENT_URI,
|
||||
GRAPHQL_URI,
|
||||
PUBLIC_REGISTRATION: process.env.PUBLIC_REGISTRATION === 'true',
|
||||
SUBSCRIPTIONS_PATH: '/subscriptions',
|
||||
}
|
||||
|
||||
export const developmentConfigs = {
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
import uuid from 'uuid/v4'
|
||||
import { neo4jgraphql } from 'neo4j-graphql-js'
|
||||
import { isEmpty } from 'lodash'
|
||||
import { UserInputError, PubSub } from 'apollo-server'
|
||||
import { UserInputError } from 'apollo-server'
|
||||
import fileUpload from './fileUpload'
|
||||
import Resolver from './helpers/Resolver'
|
||||
import { filterForMutedUsers } from './helpers/filterForMutedUsers'
|
||||
|
||||
const pubsub = new PubSub()
|
||||
const POST_ADDED = 'POST_ADDED'
|
||||
|
||||
const maintainPinnedPosts = params => {
|
||||
const pinnedPostFilter = { pinned: true }
|
||||
if (isEmpty(params.filter)) {
|
||||
@ -20,12 +17,6 @@ const maintainPinnedPosts = params => {
|
||||
}
|
||||
|
||||
export default {
|
||||
Subscription: {
|
||||
postAdded: {
|
||||
// Additional event labels can be passed to asyncIterator creation
|
||||
subscribe: () => pubsub.asyncIterator([POST_ADDED]),
|
||||
},
|
||||
},
|
||||
Query: {
|
||||
Post: async (object, params, context, resolveInfo) => {
|
||||
params = await filterForMutedUsers(params, context)
|
||||
@ -111,7 +102,6 @@ export default {
|
||||
})
|
||||
try {
|
||||
const [post] = await writeTxResultPromise
|
||||
pubsub.publish(POST_ADDED, { postAdded: post })
|
||||
return post
|
||||
} catch (e) {
|
||||
if (e.code === 'Neo.ClientError.Schema.ConstraintValidationFailed')
|
||||
|
||||
@ -245,7 +245,3 @@ type Query {
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
type Subscription {
|
||||
postAdded: Post
|
||||
}
|
||||
|
||||
@ -74,15 +74,6 @@ import { mapGetters, mapMutations } from 'vuex'
|
||||
import { filterPosts } from '~/graphql/PostQuery.js'
|
||||
import PostMutations from '~/graphql/PostMutations'
|
||||
import UpdateQuery from '~/components/utils/UpdateQuery'
|
||||
import gql from 'graphql-tag'
|
||||
import {
|
||||
userFragment,
|
||||
postFragment,
|
||||
postCountsFragment,
|
||||
userCountsFragment,
|
||||
locationAndBadgesFragment,
|
||||
tagsCategoriesAndPinnedFragment,
|
||||
} from '~/graphql/Fragments'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -222,35 +213,6 @@ export default {
|
||||
this.posts = Post
|
||||
},
|
||||
fetchPolicy: 'cache-and-network',
|
||||
subscribeToMore: {
|
||||
document: gql`
|
||||
${userFragment}
|
||||
${userCountsFragment}
|
||||
${locationAndBadgesFragment('EN')}
|
||||
${postFragment}
|
||||
${postCountsFragment}
|
||||
${tagsCategoriesAndPinnedFragment}
|
||||
|
||||
subscription Post {
|
||||
postAdded {
|
||||
...post
|
||||
...postCounts
|
||||
...tagsCategoriesAndPinned
|
||||
author {
|
||||
...user
|
||||
...userCounts
|
||||
...locationAndBadges
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
updateQuery: (previousResult, { subscriptionData }) => {
|
||||
const {
|
||||
data: { postAdded: newPost },
|
||||
} = subscriptionData
|
||||
return { Post: [newPost, ...previousResult.Post] }
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ export default ({ app }) => {
|
||||
const backendUrl = process.env.GRAPHQL_URI || 'http://localhost:4000'
|
||||
|
||||
return {
|
||||
wsEndpoint: 'ws://localhost:4000/graphql', // optional
|
||||
wsEndpoint: process.env.WEBSOCKETS_URI || 'ws://localhost:4000/graphql',
|
||||
httpEndpoint: process.server ? backendUrl : '/api',
|
||||
httpLinkOptions: {
|
||||
credentials: 'same-origin',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user