mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
* feat(backend): pin more than one post * add postPinnedCount query, better names for env variable * add store and mixin for pinned posts counts * test pinned post store * context menu for pin posts * fix typos * unpin posts is always possible * feat(backend): pin public group posts * allow posts in public groups to be pinned by admins --------- Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
204 lines
4.1 KiB
JavaScript
204 lines
4.1 KiB
JavaScript
import gql from 'graphql-tag'
|
|
import {
|
|
userFragment,
|
|
postFragment,
|
|
commentFragment,
|
|
postCountsFragment,
|
|
userCountsFragment,
|
|
locationFragment,
|
|
badgesFragment,
|
|
tagsCategoriesAndPinnedFragment,
|
|
} from './Fragments'
|
|
|
|
export default (i18n) => {
|
|
const lang = i18n.locale().toUpperCase()
|
|
return gql`
|
|
${userFragment}
|
|
${userCountsFragment}
|
|
${locationFragment(lang)}
|
|
${badgesFragment}
|
|
${postFragment}
|
|
${postCountsFragment}
|
|
${tagsCategoriesAndPinnedFragment}
|
|
${commentFragment}
|
|
|
|
query Post($id: ID!) {
|
|
Post(id: $id) {
|
|
postType
|
|
eventStart
|
|
eventEnd
|
|
eventVenue
|
|
eventLocationName
|
|
eventIsOnline
|
|
...post
|
|
...postCounts
|
|
...tagsCategoriesAndPinned
|
|
author {
|
|
...user
|
|
...userCounts
|
|
...location
|
|
...badges
|
|
blocked
|
|
}
|
|
comments(orderBy: createdAt_asc) {
|
|
...comment
|
|
author {
|
|
...user
|
|
...userCounts
|
|
...location
|
|
...badges
|
|
}
|
|
}
|
|
group {
|
|
id
|
|
name
|
|
slug
|
|
groupType
|
|
}
|
|
}
|
|
}
|
|
`
|
|
}
|
|
|
|
export const filterPosts = (i18n) => {
|
|
const lang = i18n.locale().toUpperCase()
|
|
return gql`
|
|
${userFragment}
|
|
${userCountsFragment}
|
|
${locationFragment(lang)}
|
|
${badgesFragment}
|
|
${postFragment}
|
|
${postCountsFragment}
|
|
${tagsCategoriesAndPinnedFragment}
|
|
|
|
query Post($filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [_PostOrdering]) {
|
|
Post(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
|
|
postType
|
|
eventStart
|
|
eventEnd
|
|
eventVenue
|
|
eventLocationName
|
|
eventLocation {
|
|
lng
|
|
lat
|
|
}
|
|
eventIsOnline
|
|
...post
|
|
...postCounts
|
|
...tagsCategoriesAndPinned
|
|
author {
|
|
...user
|
|
...userCounts
|
|
...location
|
|
...badges
|
|
}
|
|
group {
|
|
id
|
|
name
|
|
slug
|
|
groupType
|
|
}
|
|
}
|
|
}
|
|
`
|
|
}
|
|
|
|
export const profilePagePosts = (i18n) => {
|
|
const lang = i18n.locale().toUpperCase()
|
|
return gql`
|
|
${userFragment}
|
|
${userCountsFragment}
|
|
${locationFragment(lang)}
|
|
${badgesFragment}
|
|
${postFragment}
|
|
${postCountsFragment}
|
|
${tagsCategoriesAndPinnedFragment}
|
|
|
|
query profilePagePosts(
|
|
$filter: _PostFilter
|
|
$first: Int
|
|
$offset: Int
|
|
$orderBy: [_PostOrdering]
|
|
) {
|
|
profilePagePosts(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
|
|
postType
|
|
eventStart
|
|
eventVenue
|
|
eventLocationName
|
|
...post
|
|
...postCounts
|
|
...tagsCategoriesAndPinned
|
|
author {
|
|
...user
|
|
...userCounts
|
|
...location
|
|
...badges
|
|
}
|
|
group {
|
|
id
|
|
name
|
|
slug
|
|
groupType
|
|
}
|
|
}
|
|
}
|
|
`
|
|
}
|
|
|
|
export const PostsEmotionsByCurrentUser = () => {
|
|
return gql`
|
|
query PostsEmotionsByCurrentUser($postId: ID!) {
|
|
PostsEmotionsByCurrentUser(postId: $postId)
|
|
}
|
|
`
|
|
}
|
|
|
|
export const relatedContributions = (i18n) => {
|
|
const lang = i18n.locale().toUpperCase()
|
|
return gql`
|
|
${userFragment}
|
|
${userCountsFragment}
|
|
${locationFragment(lang)}
|
|
${badgesFragment}
|
|
${postFragment}
|
|
${postCountsFragment}
|
|
${tagsCategoriesAndPinnedFragment}
|
|
|
|
query Post($slug: String!) {
|
|
Post(slug: $slug) {
|
|
...post
|
|
...postCounts
|
|
...tagsCategoriesAndPinned
|
|
author {
|
|
...user
|
|
...userCounts
|
|
...location
|
|
...badges
|
|
}
|
|
relatedContributions(first: 2) {
|
|
...post
|
|
...postCounts
|
|
...tagsCategoriesAndPinned
|
|
author {
|
|
...user
|
|
...userCounts
|
|
...location
|
|
...badges
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
}
|
|
|
|
export const postsPinnedCountsQuery = () => {
|
|
return gql`
|
|
query {
|
|
PostsPinnedCounts {
|
|
maxPinnedPosts
|
|
currentlyPinnedPosts
|
|
}
|
|
}
|
|
`
|
|
}
|