mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +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,
|
||||
blockedUsers: isAuthenticated,
|
||||
notifications: isAuthenticated,
|
||||
profilePagePosts: or(onlyEnabledContent, isModerator),
|
||||
},
|
||||
Mutation: {
|
||||
'*': deny,
|
||||
|
||||
@ -49,6 +49,10 @@ export default {
|
||||
params = await filterForBlockedUsers(params, context)
|
||||
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) => {
|
||||
const session = context.driver.session()
|
||||
const { postId, data } = params
|
||||
|
||||
@ -95,4 +95,5 @@ type Mutation {
|
||||
type Query {
|
||||
PostsEmotionsCountByEmotion(postId: ID!, data: _EMOTEDInput!): Int!
|
||||
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 = () => {
|
||||
return gql`
|
||||
query PostsEmotionsByCurrentUser($postId: ID!) {
|
||||
|
||||
@ -281,7 +281,7 @@ import HcUpload from '~/components/Upload'
|
||||
import HcAvatar from '~/components/Avatar/Avatar.vue'
|
||||
import MasonryGrid from '~/components/MasonryGrid/MasonryGrid.vue'
|
||||
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem.vue'
|
||||
import { filterPosts } from '~/graphql/PostQuery'
|
||||
import { profilePagePosts } from '~/graphql/PostQuery'
|
||||
import UserQuery from '~/graphql/User'
|
||||
import { Block, Unblock } from '~/graphql/settings/BlockedUsers'
|
||||
import PostMutations from '~/graphql/PostMutations'
|
||||
@ -466,7 +466,7 @@ export default {
|
||||
apollo: {
|
||||
Post: {
|
||||
query() {
|
||||
return filterPosts(this.$i18n)
|
||||
return profilePagePosts(this.$i18n)
|
||||
},
|
||||
variables() {
|
||||
return {
|
||||
@ -476,8 +476,8 @@ export default {
|
||||
orderBy: ['pinnedAt_asc', 'createdAt_desc'],
|
||||
}
|
||||
},
|
||||
update({ Post }) {
|
||||
this.posts = Post
|
||||
update({ profilePagePosts }) {
|
||||
this.posts = profilePagePosts
|
||||
},
|
||||
fetchPolicy: 'cache-and-network',
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user