Mastodon API: convert reaction accounts

This commit is contained in:
Vyr Cossont 2023-07-21 16:23:15 -07:00 committed by Vyr Cossont
parent 4ebda2cae6
commit df3f2d2b5e

View file

@ -38,6 +38,12 @@ export function convertNotification(notification: Entity.Notification) {
export function convertPoll(poll: Entity.Poll) { export function convertPoll(poll: Entity.Poll) {
return simpleConvert(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) { export function convertRelationship(relationship: Entity.Relationship) {
return simpleConvert(relationship); return simpleConvert(relationship);
} }
@ -61,6 +67,7 @@ export function convertStatus(status: Entity.Status) {
})); }));
if (status.poll) status.poll = convertPoll(status.poll); if (status.poll) status.poll = convertPoll(status.poll);
if (status.reblog) status.reblog = convertStatus(status.reblog); if (status.reblog) status.reblog = convertStatus(status.reblog);
status.emoji_reactions = status.mentions.map(convertReaction);
return status; return status;
} }