fix(webapp): fix user avatar & post image urls (#8921)

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
This commit is contained in:
Ulf Gebhardt 2025-09-25 22:19:27 +02:00 committed by GitHub
parent 4fc71fc495
commit 30560bff69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 351 additions and 304 deletions

View File

@ -1,9 +1,12 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { imageUrls } from './fragments/imageUrls'
export default (i18n) => { export default (i18n) => {
const lang = i18n.locale().toUpperCase() const lang = i18n.locale().toUpperCase()
return { return {
CreateComment: gql` CreateComment: gql`
${imageUrls}
mutation ($postId: ID!, $content: String!) { mutation ($postId: ID!, $content: String!) {
CreateComment(postId: $postId, content: $content) { CreateComment(postId: $postId, content: $content) {
id id
@ -20,7 +23,7 @@ export default (i18n) => {
slug slug
name name
avatar { avatar {
url ...imageUrls
} }
disabled disabled
deleted deleted
@ -38,6 +41,8 @@ export default (i18n) => {
} }
`, `,
UpdateComment: gql` UpdateComment: gql`
${imageUrls}
mutation ($content: String!, $id: ID!) { mutation ($content: String!, $id: ID!) {
UpdateComment(content: $content, id: $id) { UpdateComment(content: $content, id: $id) {
id id
@ -52,7 +57,7 @@ export default (i18n) => {
slug slug
name name
avatar { avatar {
url ...imageUrls
} }
disabled disabled
deleted deleted
@ -61,6 +66,8 @@ export default (i18n) => {
} }
`, `,
DeleteComment: gql` DeleteComment: gql`
${imageUrls}
mutation($id: ID!) { mutation($id: ID!) {
DeleteComment(id: $id) { DeleteComment(id: $id) {
id id
@ -74,7 +81,7 @@ export default (i18n) => {
slug slug
name name
avatar { avatar {
url ...imageUrls
} }
disabled disabled
deleted deleted

View File

@ -1,8 +1,11 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { imageUrls } from './fragments/imageUrls'
export default (app) => { export default (app) => {
const lang = app.$i18n.locale().toUpperCase() const lang = app.$i18n.locale().toUpperCase()
return gql` return gql`
${imageUrls}
query Comment($postId: ID) { query Comment($postId: ID) {
Comment(postId: $postId) { Comment(postId: $postId) {
id id
@ -13,7 +16,7 @@ export default (app) => {
slug slug
name name
avatar { avatar {
url ...imageUrls
} }
disabled disabled
deleted deleted

View File

@ -1,171 +0,0 @@
import gql from 'graphql-tag'
export const userFragment = gql`
fragment user on User {
id
slug
name
avatar {
url
w320: transform(width: 320)
w640: transform(width: 640)
w1024: transform(width: 1024)
}
disabled
deleted
}
`
export const locationFragment = (type, lang) => gql`
fragment location on ${type} {
locationName
location {
id
name: name${lang}
lng
lat
distanceToMe
}
}
`
export const badgesFragment = gql`
fragment badges on User {
badgeTrophiesSelected {
id
icon
description
}
badgeVerification {
id
icon
description
}
}
`
export const userCountsFragment = gql`
fragment userCounts on User {
shoutedCount
contributionsCount
commentedCount
followedByCount
followingCount
followedByCurrentUser
}
`
export const userTeaserFragment = (lang) => gql`
${badgesFragment}
${locationFragment('User', lang)}
fragment userTeaser on User {
followedByCount
contributionsCount
commentedCount
...badges
...location
}
`
export const postFragment = gql`
fragment post on Post {
id
title
content
contentExcerpt
createdAt
updatedAt
sortDate
disabled
deleted
slug
language
image {
url
w320: transform(width: 320)
w640: transform(width: 640)
w1024: transform(width: 1024)
sensitive
aspectRatio
type
}
author {
...user
}
pinnedAt
pinned
isObservedByMe
observingUsersCount
}
`
export const groupFragment = gql`
fragment group on Group {
id
groupName: name
slug
disabled
deleted
about
description
descriptionExcerpt
groupType
actionRadius
categories {
id
slug
name
icon
}
locationName
myRole
}
`
export const postCountsFragment = gql`
fragment postCounts on Post {
commentsCount
shoutedCount
shoutedByCurrentUser
emotionsCount
clickedCount
viewedTeaserCount
viewedTeaserByCurrentUser
}
`
export const tagsCategoriesAndPinnedFragment = gql`
fragment tagsCategoriesAndPinned on Post {
tags {
id
}
categories {
id
slug
name
icon
}
pinnedBy {
id
name
role
}
}
`
export const commentFragment = gql`
fragment comment on Comment {
id
createdAt
updatedAt
disabled
deleted
content
contentExcerpt
isPostObservedByMe
postObservingUsersCount
shoutedByCurrentUser
shoutedCount
}
`

View File

@ -1,6 +1,9 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { imageUrls } from './fragments/imageUrls'
export const validateInviteCode = () => gql` export const validateInviteCode = () => gql`
${imageUrls}
query validateInviteCode($code: String!) { query validateInviteCode($code: String!) {
validateInviteCode(code: $code) { validateInviteCode(code: $code) {
code code
@ -10,13 +13,13 @@ export const validateInviteCode = () => gql`
name name
about about
avatar { avatar {
url ...imageUrls
} }
} }
generatedBy { generatedBy {
name name
avatar { avatar {
url ...imageUrls
} }
} }
isValid isValid
@ -25,6 +28,8 @@ export const validateInviteCode = () => gql`
` `
export const generatePersonalInviteCode = () => gql` export const generatePersonalInviteCode = () => gql`
${imageUrls}
mutation generatePersonalInviteCode($expiresAt: String, $comment: String) { mutation generatePersonalInviteCode($expiresAt: String, $comment: String) {
generatePersonalInviteCode(expiresAt: $expiresAt, comment: $comment) { generatePersonalInviteCode(expiresAt: $expiresAt, comment: $comment) {
code code
@ -33,14 +38,14 @@ export const generatePersonalInviteCode = () => gql`
id id
name name
avatar { avatar {
url ...imageUrls
} }
} }
redeemedBy { redeemedBy {
id id
name name
avatar { avatar {
url ...imageUrls
} }
} }
redeemedByCount redeemedByCount
@ -51,7 +56,7 @@ export const generatePersonalInviteCode = () => gql`
name name
about about
avatar { avatar {
url ...imageUrls
} }
} }
isValid isValid
@ -60,6 +65,8 @@ export const generatePersonalInviteCode = () => gql`
` `
export const generateGroupInviteCode = () => gql` export const generateGroupInviteCode = () => gql`
${imageUrls}
mutation generateGroupInviteCode($groupId: ID!, $expiresAt: String, $comment: String) { mutation generateGroupInviteCode($groupId: ID!, $expiresAt: String, $comment: String) {
generateGroupInviteCode(groupId: $groupId, expiresAt: $expiresAt, comment: $comment) { generateGroupInviteCode(groupId: $groupId, expiresAt: $expiresAt, comment: $comment) {
code code
@ -68,14 +75,14 @@ export const generateGroupInviteCode = () => gql`
id id
name name
avatar { avatar {
url ...imageUrls
} }
} }
redeemedBy { redeemedBy {
id id
name name
avatar { avatar {
url ...imageUrls
} }
} }
redeemedByCount redeemedByCount
@ -87,7 +94,7 @@ export const generateGroupInviteCode = () => gql`
name name
about about
avatar { avatar {
url ...imageUrls
} }
} }
isValid isValid
@ -96,6 +103,8 @@ export const generateGroupInviteCode = () => gql`
` `
export const invalidateInviteCode = () => gql` export const invalidateInviteCode = () => gql`
${imageUrls}
mutation invalidateInviteCode($code: String!) { mutation invalidateInviteCode($code: String!) {
invalidateInviteCode(code: $code) { invalidateInviteCode(code: $code) {
code code
@ -104,14 +113,14 @@ export const invalidateInviteCode = () => gql`
id id
name name
avatar { avatar {
url ...imageUrls
} }
} }
redeemedBy { redeemedBy {
id id
name name
avatar { avatar {
url ...imageUrls
} }
} }
redeemedByCount redeemedByCount
@ -123,7 +132,7 @@ export const invalidateInviteCode = () => gql`
name name
about about
avatar { avatar {
url ...imageUrls
} }
} }
isValid isValid

View File

@ -1,8 +1,11 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { imageUrls } from './fragments/imageUrls'
export default () => { export default () => {
return { return {
CreatePost: gql` CreatePost: gql`
${imageUrls}
mutation ( mutation (
$id: ID $id: ID
$title: String! $title: String!
@ -32,7 +35,7 @@ export default () => {
contentExcerpt contentExcerpt
language language
image { image {
url ...imageUrls
sensitive sensitive
} }
disabled disabled
@ -56,6 +59,8 @@ export default () => {
} }
`, `,
UpdatePost: gql` UpdatePost: gql`
${imageUrls}
mutation ( mutation (
$id: ID! $id: ID!
$title: String! $title: String!
@ -81,7 +86,7 @@ export default () => {
contentExcerpt contentExcerpt
language language
image { image {
url ...imageUrls
sensitive sensitive
aspectRatio aspectRatio
} }

View File

@ -1,26 +1,24 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { import { user } from './fragments/user'
userFragment, import { post } from './fragments/post'
postFragment, import { comment } from './fragments/comment'
commentFragment, import { postCounts } from './fragments/postCounts'
postCountsFragment, import { userCounts } from './fragments/userCounts'
userCountsFragment, import { location } from './fragments/location'
locationFragment, import { badges } from './fragments/badges'
badgesFragment, import { tagsCategoriesAndPinned } from './fragments/tagsCategoriesAndPinned'
tagsCategoriesAndPinnedFragment,
} from './Fragments'
export default (i18n) => { export default (i18n) => {
const lang = i18n.locale().toUpperCase() const lang = i18n.locale().toUpperCase()
return gql` return gql`
${userFragment} ${user}
${userCountsFragment} ${userCounts}
${locationFragment('User', lang)} ${location('User', lang)}
${badgesFragment} ${badges}
${postFragment} ${post}
${postCountsFragment} ${postCounts}
${tagsCategoriesAndPinnedFragment} ${tagsCategoriesAndPinned}
${commentFragment} ${comment}
query Post($id: ID!) { query Post($id: ID!) {
Post(id: $id) { Post(id: $id) {
@ -63,13 +61,13 @@ export default (i18n) => {
export const filterPosts = (i18n) => { export const filterPosts = (i18n) => {
const lang = i18n.locale().toUpperCase() const lang = i18n.locale().toUpperCase()
return gql` return gql`
${userFragment} ${user}
${userCountsFragment} ${userCounts}
${locationFragment('User', lang)} ${location('User', lang)}
${badgesFragment} ${badges}
${postFragment} ${post}
${postCountsFragment} ${postCounts}
${tagsCategoriesAndPinnedFragment} ${tagsCategoriesAndPinned}
query Post($filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [_PostOrdering]) { query Post($filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [_PostOrdering]) {
Post(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) { Post(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
@ -106,13 +104,13 @@ export const filterPosts = (i18n) => {
export const profilePagePosts = (i18n) => { export const profilePagePosts = (i18n) => {
const lang = i18n.locale().toUpperCase() const lang = i18n.locale().toUpperCase()
return gql` return gql`
${userFragment} ${user}
${userCountsFragment} ${userCounts}
${locationFragment('User', lang)} ${location('User', lang)}
${badgesFragment} ${badges}
${postFragment} ${post}
${postCountsFragment} ${postCounts}
${tagsCategoriesAndPinnedFragment} ${tagsCategoriesAndPinned}
query profilePagePosts( query profilePagePosts(
$filter: _PostFilter $filter: _PostFilter
@ -156,13 +154,13 @@ export const PostsEmotionsByCurrentUser = () => {
export const relatedContributions = (i18n) => { export const relatedContributions = (i18n) => {
const lang = i18n.locale().toUpperCase() const lang = i18n.locale().toUpperCase()
return gql` return gql`
${userFragment} ${user}
${userCountsFragment} ${userCounts}
${locationFragment('User', lang)} ${location('User', lang)}
${badgesFragment} ${badges}
${postFragment} ${post}
${postCountsFragment} ${postCounts}
${tagsCategoriesAndPinnedFragment} ${tagsCategoriesAndPinned}
query Post($slug: String!) { query Post($slug: String!) {
Post(slug: $slug) { Post(slug: $slug) {

View File

@ -1,6 +1,9 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { imageUrls } from './fragments/imageUrls'
export const createRoom = () => gql` export const createRoom = () => gql`
${imageUrls}
mutation ($userId: ID!) { mutation ($userId: ID!) {
CreateRoom(userId: $userId) { CreateRoom(userId: $userId) {
id id
@ -15,7 +18,7 @@ export const createRoom = () => gql`
id id
name name
avatar { avatar {
url ...imageUrls
} }
} }
} }
@ -23,6 +26,8 @@ export const createRoom = () => gql`
` `
export const roomQuery = () => gql` export const roomQuery = () => gql`
${imageUrls}
query Room($first: Int, $offset: Int, $id: ID) { query Room($first: Int, $offset: Int, $id: ID) {
Room(first: $first, offset: $offset, id: $id, orderBy: [createdAt_desc, lastMessageAt_desc]) { Room(first: $first, offset: $offset, id: $id, orderBy: [createdAt_desc, lastMessageAt_desc]) {
id id
@ -49,7 +54,7 @@ export const roomQuery = () => gql`
id id
name name
avatar { avatar {
url ...imageUrls
} }
} }
} }

View File

@ -1,15 +1,14 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { import { user } from './fragments/user'
userFragment, import { post } from './fragments/post'
postFragment, import { group } from './fragments/group'
groupFragment, import { tagsCategoriesAndPinned } from './fragments/tagsCategoriesAndPinned'
tagsCategoriesAndPinnedFragment, import { imageUrls } from './fragments/imageUrls'
} from './Fragments'
export const searchQuery = gql` export const searchQuery = gql`
${userFragment} ${user}
${postFragment} ${post}
${groupFragment} ${group}
query ($query: String!) { query ($query: String!) {
searchResults(query: $query, limit: 5) { searchResults(query: $query, limit: 5) {
@ -38,9 +37,9 @@ export const searchQuery = gql`
` `
export const searchPosts = gql` export const searchPosts = gql`
${userFragment} ${user}
${postFragment} ${post}
${tagsCategoriesAndPinnedFragment} ${tagsCategoriesAndPinned}
query ($query: String!, $firstPosts: Int, $postsOffset: Int) { query ($query: String!, $firstPosts: Int, $postsOffset: Int) {
searchPosts(query: $query, firstPosts: $firstPosts, postsOffset: $postsOffset) { searchPosts(query: $query, firstPosts: $firstPosts, postsOffset: $postsOffset) {
@ -74,6 +73,8 @@ export const searchPosts = gql`
export const searchGroups = (i18n) => { export const searchGroups = (i18n) => {
const lang = i18n ? i18n.locale().toUpperCase() : 'EN' const lang = i18n ? i18n.locale().toUpperCase() : 'EN'
return gql` return gql`
${imageUrls}
query ($query: String!, $firstGroups: Int, $groupsOffset: Int) { query ($query: String!, $firstGroups: Int, $groupsOffset: Int) {
searchGroups(query: $query, firstGroups: $firstGroups, groupsOffset: $groupsOffset) { searchGroups(query: $query, firstGroups: $firstGroups, groupsOffset: $groupsOffset) {
groupCount groupCount
@ -98,7 +99,7 @@ export const searchGroups = (i18n) => {
icon icon
} }
avatar { avatar {
url ...imageUrls
} }
locationName locationName
location { location {
@ -112,7 +113,7 @@ export const searchGroups = (i18n) => {
} }
export const searchUsers = gql` export const searchUsers = gql`
${userFragment} ${user}
query ($query: String!, $firstUsers: Int, $usersOffset: Int) { query ($query: String!, $firstUsers: Int, $usersOffset: Int) {
searchUsers(query: $query, firstUsers: $firstUsers, usersOffset: $usersOffset) { searchUsers(query: $query, firstUsers: $firstUsers, usersOffset: $usersOffset) {

View File

@ -1,22 +1,20 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { import { badges } from './fragments/badges'
userCountsFragment, import { location } from './fragments/location'
locationFragment, import { userCounts } from './fragments/userCounts'
badgesFragment, import { user } from './fragments/user'
userFragment, import { post } from './fragments/post'
postFragment, import { comment } from './fragments/comment'
commentFragment, import { group } from './fragments/group'
groupFragment, import { imageUrls } from './fragments/imageUrls'
userTeaserFragment,
} from './Fragments'
export const profileUserQuery = (i18n) => { export const profileUserQuery = (i18n) => {
const lang = i18n.locale().toUpperCase() const lang = i18n.locale().toUpperCase()
return gql` return gql`
${userFragment} ${user}
${userCountsFragment} ${userCounts}
${locationFragment('User', lang)} ${location('User', lang)}
${badgesFragment} ${badges}
query User($id: ID!, $followedByCount: Int!, $followingCount: Int!) { query User($id: ID!, $followedByCount: Int!, $followingCount: Int!) {
User(id: $id) { User(id: $id) {
@ -54,13 +52,15 @@ export const profileUserQuery = (i18n) => {
export const minimisedUserQuery = () => { export const minimisedUserQuery = () => {
return gql` return gql`
${imageUrls}
query ($slug: String) { query ($slug: String) {
User(slug: $slug, orderBy: slug_asc) { User(slug: $slug, orderBy: slug_asc) {
id id
slug slug
name name
avatar { avatar {
url ...imageUrls
} }
} }
} }
@ -111,9 +111,9 @@ export const adminUserBadgesQuery = () => {
export const mapUserQuery = (i18n) => { export const mapUserQuery = (i18n) => {
const lang = i18n.locale().toUpperCase() const lang = i18n.locale().toUpperCase()
return gql` return gql`
${userFragment} ${user}
${locationFragment('User', lang)} ${location('User', lang)}
${badgesFragment} ${badges}
query { query {
User { User {
@ -128,10 +128,10 @@ export const mapUserQuery = (i18n) => {
export const notificationQuery = () => { export const notificationQuery = () => {
return gql` return gql`
${userFragment} ${user}
${commentFragment} ${comment}
${postFragment} ${post}
${groupFragment} ${group}
query ($read: Boolean, $orderBy: NotificationOrdering, $first: Int, $offset: Int) { query ($read: Boolean, $orderBy: NotificationOrdering, $first: Int, $offset: Int) {
notifications(read: $read, orderBy: $orderBy, first: $first, offset: $offset) { notifications(read: $read, orderBy: $orderBy, first: $first, offset: $offset) {
@ -177,10 +177,10 @@ export const notificationQuery = () => {
export const markAsReadMutation = (_i18n) => { export const markAsReadMutation = (_i18n) => {
return gql` return gql`
${userFragment} ${user}
${commentFragment} ${comment}
${postFragment} ${post}
${groupFragment} ${group}
mutation ($id: ID!) { mutation ($id: ID!) {
markAsRead(id: $id) { markAsRead(id: $id) {
@ -217,10 +217,10 @@ export const markAsReadMutation = (_i18n) => {
export const markAllAsReadMutation = (_i18n) => { export const markAllAsReadMutation = (_i18n) => {
return gql` return gql`
${userFragment} ${user}
${commentFragment} ${comment}
${postFragment} ${post}
${groupFragment} ${group}
mutation { mutation {
markAllAsRead { markAllAsRead {
@ -257,10 +257,10 @@ export const markAllAsReadMutation = (_i18n) => {
export const notificationAdded = () => { export const notificationAdded = () => {
return gql` return gql`
${userFragment} ${user}
${commentFragment} ${comment}
${postFragment} ${post}
${groupFragment} ${group}
subscription notifications { subscription notifications {
notificationAdded { notificationAdded {
@ -305,8 +305,8 @@ export const notificationAdded = () => {
} }
export const followUserMutation = (i18n) => { export const followUserMutation = (i18n) => {
return gql` return gql`
${userFragment} ${user}
${userCountsFragment} ${userCounts}
mutation ($id: ID!) { mutation ($id: ID!) {
followUser(id: $id) { followUser(id: $id) {
@ -325,8 +325,8 @@ export const followUserMutation = (i18n) => {
export const unfollowUserMutation = (i18n) => { export const unfollowUserMutation = (i18n) => {
return gql` return gql`
${userFragment} ${user}
${userCountsFragment} ${userCounts}
mutation ($id: ID!) { mutation ($id: ID!) {
unfollowUser(id: $id) { unfollowUser(id: $id) {
@ -345,6 +345,8 @@ export const unfollowUserMutation = (i18n) => {
export const updateUserMutation = () => { export const updateUserMutation = () => {
return gql` return gql`
${imageUrls}
mutation ( mutation (
$id: ID! $id: ID!
$slug: String $slug: String
@ -386,7 +388,7 @@ export const updateUserMutation = () => {
locale locale
termsAndConditionsAgreedVersion termsAndConditionsAgreedVersion
avatar { avatar {
url ...imageUrls
} }
badgeVerification { badgeVerification {
id id
@ -407,7 +409,7 @@ export const checkSlugAvailableQuery = gql`
` `
export const currentUserQuery = gql` export const currentUserQuery = gql`
${userFragment} ${user}
query { query {
currentUser { currentUser {
...user ...user
@ -461,7 +463,7 @@ export const currentUserQuery = gql`
` `
export const currentUserCountQuery = () => gql` export const currentUserCountQuery = () => gql`
${userCountsFragment} ${userCounts}
query { query {
currentUser { currentUser {
...userCounts ...userCounts
@ -471,9 +473,9 @@ export const currentUserCountQuery = () => gql`
export const userDataQuery = (i18n) => { export const userDataQuery = (i18n) => {
return gql` return gql`
${userFragment} ${user}
${postFragment} ${post}
${commentFragment} ${comment}
query ($id: ID!) { query ($id: ID!) {
userData(id: $id) { userData(id: $id) {
user { user {
@ -501,10 +503,16 @@ export const userDataQuery = (i18n) => {
export const userTeaserQuery = (i18n) => { export const userTeaserQuery = (i18n) => {
const lang = i18n.locale().toUpperCase() const lang = i18n.locale().toUpperCase()
return gql` return gql`
${userTeaserFragment(lang)} ${badges}
${location('User', lang)}
query ($id: ID!) { query ($id: ID!) {
User(id: $id) { User(id: $id) {
...userTeaser followedByCount
contributionsCount
commentedCount
...badges
...location
} }
} }
` `

View File

@ -0,0 +1,16 @@
import gql from 'graphql-tag'
export const badges = gql`
fragment badges on User {
badgeTrophiesSelected {
id
icon
description
}
badgeVerification {
id
icon
description
}
}
`

View File

@ -0,0 +1,17 @@
import gql from 'graphql-tag'
export const comment = gql`
fragment comment on Comment {
id
createdAt
updatedAt
disabled
deleted
content
contentExcerpt
isPostObservedByMe
postObservingUsersCount
shoutedByCurrentUser
shoutedCount
}
`

View File

@ -0,0 +1,24 @@
import gql from 'graphql-tag'
export const group = gql`
fragment group on Group {
id
groupName: name
slug
disabled
deleted
about
description
descriptionExcerpt
groupType
actionRadius
categories {
id
slug
name
icon
}
locationName
myRole
}
`

View File

@ -0,0 +1,10 @@
import gql from 'graphql-tag'
export const imageUrls = gql`
fragment imageUrls on Image {
url
w320: transform(width: 320)
w640: transform(width: 640)
w1024: transform(width: 1024)
}
`

View File

@ -0,0 +1,14 @@
import gql from 'graphql-tag'
export const location = (type, lang) => gql`
fragment location on ${type} {
locationName
location {
id
name: name${lang}
lng
lat
distanceToMe
}
}
`

View File

@ -0,0 +1,33 @@
import gql from 'graphql-tag'
import { imageUrls } from './imageUrls'
export const post = gql`
${imageUrls}
fragment post on Post {
id
title
content
contentExcerpt
createdAt
updatedAt
sortDate
disabled
deleted
slug
language
image {
...imageUrls
sensitive
aspectRatio
type
}
author {
...user
}
pinnedAt
pinned
isObservedByMe
observingUsersCount
}
`

View File

@ -0,0 +1,13 @@
import gql from 'graphql-tag'
export const postCounts = gql`
fragment postCounts on Post {
commentsCount
shoutedCount
shoutedByCurrentUser
emotionsCount
clickedCount
viewedTeaserCount
viewedTeaserByCurrentUser
}
`

View File

@ -0,0 +1,20 @@
import gql from 'graphql-tag'
export const tagsCategoriesAndPinned = gql`
fragment tagsCategoriesAndPinned on Post {
tags {
id
}
categories {
id
slug
name
icon
}
pinnedBy {
id
name
role
}
}
`

View File

@ -0,0 +1,16 @@
import gql from 'graphql-tag'
import { imageUrls } from './imageUrls'
export const user = gql`
${imageUrls}
fragment user on User {
id
slug
name
avatar {
...imageUrls
}
disabled
deleted
}
`

View File

@ -0,0 +1,12 @@
import gql from 'graphql-tag'
export const userCounts = gql`
fragment userCounts on User {
shoutedCount
contributionsCount
commentedCount
followedByCount
followingCount
followedByCurrentUser
}
`

View File

@ -1,5 +1,6 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { locationFragment } from './Fragments' import { location } from './fragments/location'
import { imageUrls } from './fragments/imageUrls'
// ------ mutations // ------ mutations
@ -54,6 +55,8 @@ export const createGroupMutation = () => {
export const updateGroupMutation = () => { export const updateGroupMutation = () => {
return gql` return gql`
${imageUrls}
mutation ( mutation (
$id: ID! $id: ID!
$name: String $name: String
@ -95,7 +98,7 @@ export const updateGroupMutation = () => {
icon icon
} }
avatar { avatar {
url ...imageUrls
} }
locationName locationName
myRole myRole
@ -161,7 +164,9 @@ export const removeUserFromGroupMutation = () => {
export const groupQuery = (i18n) => { export const groupQuery = (i18n) => {
const lang = i18n ? i18n.locale().toUpperCase() : 'EN' const lang = i18n ? i18n.locale().toUpperCase() : 'EN'
return gql` return gql`
${locationFragment('Group', lang)} ${location('Group', lang)}
${imageUrls}
query ($isMember: Boolean, $id: ID, $slug: String, $first: Int, $offset: Int) { query ($isMember: Boolean, $id: ID, $slug: String, $first: Int, $offset: Int) {
Group(isMember: $isMember, id: $id, slug: $slug, first: $first, offset: $offset) { Group(isMember: $isMember, id: $id, slug: $slug, first: $first, offset: $offset) {
id id
@ -184,10 +189,7 @@ export const groupQuery = (i18n) => {
icon icon
} }
avatar { avatar {
url ...imageUrls
w320: transform(width: 320)
w640: transform(width: 640)
w1024: transform(width: 1024)
} }
...location ...location
membersCount membersCount
@ -209,6 +211,8 @@ export const groupQuery = (i18n) => {
export const groupMembersQuery = () => { export const groupMembersQuery = () => {
return gql` return gql`
${imageUrls}
query ($id: ID!, $first: Int, $offset: Int) { query ($id: ID!, $first: Int, $offset: Int) {
GroupMembers(id: $id, first: $first, offset: $offset) { GroupMembers(id: $id, first: $first, offset: $offset) {
id id
@ -216,10 +220,7 @@ export const groupMembersQuery = () => {
slug slug
myRoleInGroup myRoleInGroup
avatar { avatar {
url ...imageUrls
w320: transform(width: 320)
w640: transform(width: 640)
w1024: transform(width: 1024)
} }
} }
} }

View File

@ -1,14 +1,17 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { imageUrls } from '../fragments/imageUrls'
export const blockedUsers = () => { export const blockedUsers = () => {
return gql` return gql`
{ ${imageUrls}
query {
blockedUsers { blockedUsers {
id id
name name
slug slug
avatar { avatar {
url ...imageUrls
} }
about about
disabled disabled

View File

@ -1,14 +1,17 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { imageUrls } from '../fragments/imageUrls'
export const mutedUsers = () => { export const mutedUsers = () => {
return gql` return gql`
{ ${imageUrls}
query {
mutedUsers { mutedUsers {
id id
name name
slug slug
avatar { avatar {
url ...imageUrls
} }
about about
disabled disabled