From 226df6999613f120c30e46068366f18f1a86cded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 23 Aug 2024 19:39:07 +0200 Subject: [PATCH] Fix reactions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- src/utils/emoji-reacts.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/utils/emoji-reacts.ts b/src/utils/emoji-reacts.ts index c354bb63c4..d2b671771d 100644 --- a/src/utils/emoji-reacts.ts +++ b/src/utils/emoji-reacts.ts @@ -1,6 +1,8 @@ import { List as ImmutableList } from 'immutable'; import { emojiReactionSchema, type EmojiReaction } from 'pl-api'; +import type { Status } from 'soapbox/normalizers'; + // https://emojipedia.org/facebook // I've customized them. const ALLOWED_EMOJI = ImmutableList([ @@ -41,11 +43,14 @@ const reduceEmoji = (emojiReacts: Array | null, favouritesCount: allowedEmoji, )); -const getReactForStatus = (status: any, allowedEmoji = ALLOWED_EMOJI): EmojiReaction | undefined => { - if (!status.reactions) return; +const getReactForStatus = ( + status: Pick, + allowedEmoji = ALLOWED_EMOJI, +): EmojiReaction | undefined => { + if (!status.emoji_reactions) return; const result = reduceEmoji( - status.reactions, + status.emoji_reactions, status.favourites_count || 0, status.favourited, allowedEmoji,