feat(api): Make Reactions API correctly output whether a reaction is remote

This commit is contained in:
Jesse Wierzbinski 2025-05-28 17:07:24 +02:00
parent e0adaca2a2
commit fa1dd69e2d
No known key found for this signature in database
5 changed files with 139 additions and 3 deletions

View file

@ -948,6 +948,7 @@ export class Note extends BaseInterface<typeof Notes, NoteTypeWithRelations> {
{
count: number;
me: boolean;
instance: typeof Instance.$type | null;
account_ids: string[];
}
>();
@ -958,8 +959,10 @@ export class Note extends BaseInterface<typeof Notes, NoteTypeWithRelations> {
// Determine emoji name based on type
if (reaction.emojiText) {
emojiName = reaction.emojiText;
} else if (reaction.emoji) {
} else if (reaction.emoji?.instance === null) {
emojiName = `:${reaction.emoji.shortcode}:`;
} else if (reaction.emoji?.instance) {
emojiName = `:${reaction.emoji.shortcode}@${reaction.emoji.instance.baseUrl}:`;
} else {
continue; // Skip invalid reactions
}
@ -970,6 +973,7 @@ export class Note extends BaseInterface<typeof Notes, NoteTypeWithRelations> {
count: 0,
me: false,
account_ids: [],
instance: reaction.emoji?.instance ?? null,
});
}
@ -994,6 +998,7 @@ export class Note extends BaseInterface<typeof Notes, NoteTypeWithRelations> {
count: data.count,
me: data.me,
account_ids: data.account_ids,
remote: data.instance !== null,
}));
}
}