mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-17 10:21:31 +00:00
groupPinned field on post
This commit is contained in:
parent
c3ad9da30a
commit
6be2f3ac9b
@ -18,6 +18,7 @@ import { filterPostsOfMyGroups } from './helpers/filterPostsOfMyGroups'
|
||||
import Resolver from './helpers/Resolver'
|
||||
import { images } from './images/images'
|
||||
import { createOrUpdateLocations } from './users/location'
|
||||
import { r } from '@faker-js/faker/dist/airline-CLphikKp'
|
||||
|
||||
const maintainPinnedPosts = (params) => {
|
||||
const pinnedPostFilter = { pinned: true }
|
||||
@ -647,6 +648,18 @@ export default {
|
||||
'MATCH (this)<-[obs:OBSERVES]-(related:User {id: $cypherParams.currentUserId}) WHERE obs.active = true RETURN COUNT(related) >= 1',
|
||||
},
|
||||
}),
|
||||
groupPinned: async (parent, _params, context, _resolveInfo) => {
|
||||
return (
|
||||
(
|
||||
await context.database.query({
|
||||
query: `
|
||||
MATCH (:User)-[pinned:GROUP_PINNED]->(:Post {id: $parent.id})
|
||||
RETURN pinned`,
|
||||
variables: { parent },
|
||||
})
|
||||
).records.length === 1
|
||||
)
|
||||
},
|
||||
relatedContributions: async (parent, _params, context, _resolveInfo) => {
|
||||
if (typeof parent.relatedContributions !== 'undefined') return parent.relatedContributions
|
||||
const { id } = parent
|
||||
|
||||
@ -128,6 +128,7 @@ type Post {
|
||||
deleted: Boolean
|
||||
disabled: Boolean
|
||||
pinned: Boolean
|
||||
groupPinned: Boolean
|
||||
createdAt: String
|
||||
updatedAt: String
|
||||
sortDate: String
|
||||
|
||||
@ -205,10 +205,10 @@ export default {
|
||||
)
|
||||
},
|
||||
isPinned() {
|
||||
return this.post && this.post.pinned
|
||||
return this.post && (this.post.pinned || this.post.groupPinned)
|
||||
},
|
||||
ribbonText() {
|
||||
if (this.post.pinned) return this.$t('post.pinned')
|
||||
if (this.post.pinned || this.post.groupPinned) return this.$t('post.pinned')
|
||||
if (this.post.postType[0] === 'Event') return this.$t('post.event')
|
||||
return this.$t('post.name')
|
||||
},
|
||||
|
||||
@ -27,6 +27,7 @@ export const post = gql`
|
||||
}
|
||||
pinnedAt
|
||||
pinned
|
||||
groupPinned
|
||||
isObservedByMe
|
||||
observingUsersCount
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user