mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Improve notification query performance
Just don't ask for stuff that you don't want to show anyways
This commit is contained in:
parent
3beef5e3fb
commit
deefc4e12f
@ -1,5 +1,15 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const linkableUserFragment = lang => gql`
|
||||
fragment user on User {
|
||||
id
|
||||
slug
|
||||
name
|
||||
avatar
|
||||
disabled
|
||||
deleted
|
||||
}
|
||||
`
|
||||
export const userFragment = lang => gql`
|
||||
fragment user on User {
|
||||
id
|
||||
@ -32,8 +42,6 @@ export const postCountsFragment = gql`
|
||||
}
|
||||
`
|
||||
export const postFragment = lang => gql`
|
||||
${userFragment(lang)}
|
||||
|
||||
fragment post on Post {
|
||||
id
|
||||
title
|
||||
@ -68,8 +76,6 @@ export const postFragment = lang => gql`
|
||||
}
|
||||
`
|
||||
export const commentFragment = lang => gql`
|
||||
${userFragment(lang)}
|
||||
|
||||
fragment comment on Comment {
|
||||
id
|
||||
createdAt
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { postFragment, commentFragment, postCountsFragment } from './Fragments'
|
||||
import { userFragment, postFragment, commentFragment, postCountsFragment } from './Fragments'
|
||||
|
||||
export default i18n => {
|
||||
const lang = i18n.locale().toUpperCase()
|
||||
return gql`
|
||||
${userFragment(lang)}
|
||||
${postFragment(lang)}
|
||||
${postCountsFragment}
|
||||
${commentFragment(lang)}
|
||||
@ -23,6 +24,7 @@ export default i18n => {
|
||||
export const filterPosts = i18n => {
|
||||
const lang = i18n.locale().toUpperCase()
|
||||
return gql`
|
||||
${userFragment(lang)}
|
||||
${postFragment(lang)}
|
||||
${postCountsFragment}
|
||||
|
||||
@ -38,6 +40,7 @@ export const filterPosts = i18n => {
|
||||
export const profilePagePosts = i18n => {
|
||||
const lang = i18n.locale().toUpperCase()
|
||||
return gql`
|
||||
${userFragment(lang)}
|
||||
${postFragment(lang)}
|
||||
${postCountsFragment}
|
||||
|
||||
@ -66,6 +69,7 @@ export const PostsEmotionsByCurrentUser = () => {
|
||||
export const relatedContributions = i18n => {
|
||||
const lang = i18n.locale().toUpperCase()
|
||||
return gql`
|
||||
${userFragment(lang)}
|
||||
${postFragment(lang)}
|
||||
${postCountsFragment}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { userFragment, postFragment, commentFragment } from './Fragments'
|
||||
import { linkableUserFragment, userFragment, postFragment, commentFragment } from './Fragments'
|
||||
|
||||
export default i18n => {
|
||||
const lang = i18n.locale().toUpperCase()
|
||||
@ -49,6 +49,7 @@ export const minimisedUserQuery = () => {
|
||||
export const notificationQuery = i18n => {
|
||||
const lang = i18n.locale().toUpperCase()
|
||||
return gql`
|
||||
${linkableUserFragment()}
|
||||
${commentFragment(lang)}
|
||||
${postFragment(lang)}
|
||||
|
||||
@ -78,6 +79,7 @@ export const notificationQuery = i18n => {
|
||||
export const markAsReadMutation = i18n => {
|
||||
const lang = i18n.locale().toUpperCase()
|
||||
return gql`
|
||||
${linkableUserFragment()}
|
||||
${commentFragment(lang)}
|
||||
${postFragment(lang)}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user