mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Add profilePagePostsQuery to deal with bug
- we do not want to add pinnedPosts to every user's profile page
This commit is contained in:
parent
b45fd51d15
commit
411bbabcd5
@ -134,6 +134,7 @@ const permissions = shield(
|
|||||||
PostsEmotionsByCurrentUser: isAuthenticated,
|
PostsEmotionsByCurrentUser: isAuthenticated,
|
||||||
blockedUsers: isAuthenticated,
|
blockedUsers: isAuthenticated,
|
||||||
notifications: isAuthenticated,
|
notifications: isAuthenticated,
|
||||||
|
profilePagePosts: or(onlyEnabledContent, isModerator),
|
||||||
},
|
},
|
||||||
Mutation: {
|
Mutation: {
|
||||||
'*': deny,
|
'*': deny,
|
||||||
|
|||||||
@ -49,6 +49,10 @@ export default {
|
|||||||
params = await filterForBlockedUsers(params, context)
|
params = await filterForBlockedUsers(params, context)
|
||||||
return neo4jgraphql(object, params, context, resolveInfo, false)
|
return neo4jgraphql(object, params, context, resolveInfo, false)
|
||||||
},
|
},
|
||||||
|
profilePagePosts: async (object, params, context, resolveInfo) => {
|
||||||
|
params = await filterForBlockedUsers(params, context)
|
||||||
|
return neo4jgraphql(object, params, context, resolveInfo, false)
|
||||||
|
},
|
||||||
PostsEmotionsCountByEmotion: async (object, params, context, resolveInfo) => {
|
PostsEmotionsCountByEmotion: async (object, params, context, resolveInfo) => {
|
||||||
const session = context.driver.session()
|
const session = context.driver.session()
|
||||||
const { postId, data } = params
|
const { postId, data } = params
|
||||||
|
|||||||
@ -95,4 +95,5 @@ type Mutation {
|
|||||||
type Query {
|
type Query {
|
||||||
PostsEmotionsCountByEmotion(postId: ID!, data: _EMOTEDInput!): Int!
|
PostsEmotionsCountByEmotion(postId: ID!, data: _EMOTEDInput!): Int!
|
||||||
PostsEmotionsByCurrentUser(postId: ID!): [String]
|
PostsEmotionsByCurrentUser(postId: ID!): [String]
|
||||||
|
profilePagePosts(filter: _PostFilter, first: Int, offset: Int, orderBy: [_PostOrdering]): [Post]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,26 @@ export const filterPosts = i18n => {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const profilePagePosts = i18n => {
|
||||||
|
const lang = i18n.locale().toUpperCase()
|
||||||
|
return gql`
|
||||||
|
${postFragment(lang)}
|
||||||
|
${postCountsFragment}
|
||||||
|
|
||||||
|
query profilePagePosts(
|
||||||
|
$filter: _PostFilter
|
||||||
|
$first: Int
|
||||||
|
$offset: Int
|
||||||
|
$orderBy: [_PostOrdering]
|
||||||
|
) {
|
||||||
|
profilePagePosts(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
|
||||||
|
...post
|
||||||
|
...postCounts
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
export const PostsEmotionsByCurrentUser = () => {
|
export const PostsEmotionsByCurrentUser = () => {
|
||||||
return gql`
|
return gql`
|
||||||
query PostsEmotionsByCurrentUser($postId: ID!) {
|
query PostsEmotionsByCurrentUser($postId: ID!) {
|
||||||
|
|||||||
@ -281,7 +281,7 @@ import HcUpload from '~/components/Upload'
|
|||||||
import HcAvatar from '~/components/Avatar/Avatar.vue'
|
import HcAvatar from '~/components/Avatar/Avatar.vue'
|
||||||
import MasonryGrid from '~/components/MasonryGrid/MasonryGrid.vue'
|
import MasonryGrid from '~/components/MasonryGrid/MasonryGrid.vue'
|
||||||
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem.vue'
|
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem.vue'
|
||||||
import { filterPosts } from '~/graphql/PostQuery'
|
import { profilePagePosts } from '~/graphql/PostQuery'
|
||||||
import UserQuery from '~/graphql/User'
|
import UserQuery from '~/graphql/User'
|
||||||
import { Block, Unblock } from '~/graphql/settings/BlockedUsers'
|
import { Block, Unblock } from '~/graphql/settings/BlockedUsers'
|
||||||
import PostMutations from '~/graphql/PostMutations'
|
import PostMutations from '~/graphql/PostMutations'
|
||||||
@ -466,7 +466,7 @@ export default {
|
|||||||
apollo: {
|
apollo: {
|
||||||
Post: {
|
Post: {
|
||||||
query() {
|
query() {
|
||||||
return filterPosts(this.$i18n)
|
return profilePagePosts(this.$i18n)
|
||||||
},
|
},
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
@ -476,8 +476,8 @@ export default {
|
|||||||
orderBy: ['pinnedAt_asc', 'createdAt_desc'],
|
orderBy: ['pinnedAt_asc', 'createdAt_desc'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
update({ Post }) {
|
update({ profilePagePosts }) {
|
||||||
this.posts = Post
|
this.posts = profilePagePosts
|
||||||
},
|
},
|
||||||
fetchPolicy: 'cache-and-network',
|
fetchPolicy: 'cache-and-network',
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user