mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
Make media uploads work with s3 backend
This commit is contained in:
parent
9064590292
commit
818fcf8666
3 changed files with 141 additions and 8 deletions
|
|
@ -22,6 +22,8 @@ import {
|
|||
import { emojiToAPI, emojiToLysand, parseEmojis } from "./Emoji";
|
||||
import type { APIStatus } from "~types/entities/status";
|
||||
import { applicationToAPI } from "./Application";
|
||||
import { attachmentToAPI } from "./Attachment";
|
||||
import type { APIAttachment } from "~types/entities/attachment";
|
||||
|
||||
const config = getConfig();
|
||||
|
||||
|
|
@ -53,6 +55,7 @@ export const statusAndUserRelations: Prisma.StatusInclude = {
|
|||
},
|
||||
},
|
||||
},
|
||||
reblogs: true,
|
||||
attachments: true,
|
||||
instance: true,
|
||||
mentions: {
|
||||
|
|
@ -438,7 +441,10 @@ export const statusToAPI = async (
|
|||
),
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
favourites_count: (status.likes ?? []).length,
|
||||
media_attachments: [],
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
media_attachments: (status.attachments ?? []).map(
|
||||
a => attachmentToAPI(a) as APIAttachment
|
||||
),
|
||||
// @ts-expect-error Prisma TypeScript types dont include relations
|
||||
mentions: status.mentions.map(mention => userToAPI(mention)),
|
||||
language: null,
|
||||
|
|
@ -458,11 +464,7 @@ export const statusToAPI = async (
|
|||
reblogId: status.id,
|
||||
},
|
||||
})),
|
||||
reblogs_count: await client.status.count({
|
||||
where: {
|
||||
reblogId: status.id,
|
||||
},
|
||||
}),
|
||||
reblogs_count: status._count.reblogs,
|
||||
replies_count: status._count.replies,
|
||||
sensitive: status.sensitive,
|
||||
spoiler_text: status.spoilerText,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue