From f906ec1d552e72b87a41237d68c687055bd7979a Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Fri, 15 Sep 2023 17:51:35 +0200 Subject: [PATCH] [mastodon-client] Fix note favorite status --- packages/backend/src/server/api/mastodon/converters/note.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/mastodon/converters/note.ts b/packages/backend/src/server/api/mastodon/converters/note.ts index dad172792..d70fba390 100644 --- a/packages/backend/src/server/api/mastodon/converters/note.ts +++ b/packages/backend/src/server/api/mastodon/converters/note.ts @@ -43,6 +43,8 @@ export class NoteConverter { noteId: note.id, }) : null; + const isFavorited = Promise.resolve(reaction).then(p => !!p); + const isReblogged = user ? Notes.exist({ where: { userId: user.id, @@ -98,7 +100,7 @@ export class NoteConverter { reblogs_count: note.renoteCount, favourites_count: reactionCount, reblogged: isReblogged, - favourited: !!reaction, + favourited: isFavorited, muted: isMuted, sensitive: files.then(files => files.length > 0 ? files.some((f) => f.isSensitive) : false), spoiler_text: note.cw ? note.cw : "",