fix (backend, Mastodon API): add 'meta.original' field to media attachments

addresses https://github.com/whitescent/Mastify/pull/102
This commit is contained in:
naskya 2024-04-17 17:46:23 +09:00
parent 86f2e32c66
commit 17fb05430e
No known key found for this signature in database
GPG Key ID: 712D413B3A9FED5C
1 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { Entity } from "megalodon";
import type { Entity } from "megalodon";
import { toMastodonId } from "backend-rs";
function simpleConvert(data: any) {
@ -15,7 +15,19 @@ export function convertAnnouncement(announcement: Entity.Announcement) {
return simpleConvert(announcement);
}
export function convertAttachment(attachment: Entity.Attachment) {
return simpleConvert(attachment);
const converted = simpleConvert(attachment);
// ref: https://github.com/whitescent/Mastify/pull/102
if (converted.meta == null) return converted;
const result = {
...converted,
meta: {
...converted.meta,
original: {
...converted.meta,
},
},
};
return result;
}
export function convertFilter(filter: Entity.Filter) {
return simpleConvert(filter);