From 0394f22c4ff204d0a56a5dbf44b7607fb0285ca4 Mon Sep 17 00:00:00 2001 From: Vyr Cossont Date: Fri, 21 Jul 2023 16:23:15 -0700 Subject: [PATCH] fix: convert quoted status and reaction accounts in Mastodon API layer --- packages/backend/src/server/api/mastodon/converters.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/backend/src/server/api/mastodon/converters.ts b/packages/backend/src/server/api/mastodon/converters.ts index cbaf5287f6..3ee9813ae4 100644 --- a/packages/backend/src/server/api/mastodon/converters.ts +++ b/packages/backend/src/server/api/mastodon/converters.ts @@ -38,6 +38,12 @@ export function convertNotification(notification: Entity.Notification) { export function convertPoll(poll: Entity.Poll) { return simpleConvert(poll); } +export function convertReaction(reaction: Entity.Reaction) { + if (reaction.accounts) { + reaction.accounts = reaction.accounts.map(convertAccount); + } + return reaction; +} export function convertRelationship(relationship: Entity.Relationship) { return simpleConvert(relationship); } @@ -61,6 +67,8 @@ export function convertStatus(status: Entity.Status) { })); if (status.poll) status.poll = convertPoll(status.poll); if (status.reblog) status.reblog = convertStatus(status.reblog); + if (status.quote) status.quote = convertStatus(status.quote); + status.emoji_reactions = status.mentions.map(convertReaction); return status; }