Robert Schäfer 00da9e8ecb
feat(backend): resize images with imagor (#8558)
* feat(backend): resize images with imagor

Open questions:
* Do we have external URLs for images? E.g. we have them for seeds. But
  in production?

* Do we want to apply image transformations on these as well? My current
implementation does not apply image transformations as of now. If we
want to do that, we will also expose internal URLs in the kubernetes
Cluster to the S3 endpoint to the client.

TODOs:
* The chat component is using a fixed size for all avatars at the moment.
Maybe we can pair-program on this how to implement responsive images in
this component library.

Commits:
* do not replace upload domain url in the database

* fix all webapp specs

* refactor: remove behaviour we won't need

We don't want to apply image transformations on files, right?

* refactor: replace the domain on read not on write

* wip: webapp fixes

* refactor(backend): add another url to config

I've given up. There seems to be no nice way to tell the minio to return
a location which differs from it's host name.

* refactor: add test for s3Service

* refactor(backend): proxy minio via backend in local development

Commits:
* provide tests for message attachments
* remove S3_PUBLIC_URL config value

* refactor: follow @ulfgebhardt's review

* add missing environment variable

---------

Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
2025-08-19 10:11:12 +02:00

172 lines
2.6 KiB
JavaScript

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 = (lang) => gql`
fragment location on User {
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(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
}
`