From e614d816f8c4012b160fd35124641bbf73bbc80c Mon Sep 17 00:00:00 2001 From: zubiden <19638254+zubiden@users.noreply.github.com> Date: Sat, 26 Oct 2024 13:02:06 +0400 Subject: [PATCH] Reactions: Fix adding new custom reaction (#5111) --- src/components/middle/message/reactions/ReactionPicker.tsx | 7 +++---- src/components/middle/message/reactions/Reactions.tsx | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/middle/message/reactions/ReactionPicker.tsx b/src/components/middle/message/reactions/ReactionPicker.tsx index b84fd44fc..152630aae 100644 --- a/src/components/middle/message/reactions/ReactionPicker.tsx +++ b/src/components/middle/message/reactions/ReactionPicker.tsx @@ -7,7 +7,6 @@ import type { ApiMessage, ApiMessageEntity, ApiReaction, - ApiReactionCustomEmoji, ApiReactionWithPaid, ApiSticker, ApiStory, @@ -119,9 +118,9 @@ const ReactionPicker: FC = ({ if (!renderedChatId || !renderedMessageId) { return; } - const reaction = sticker.isCustomEmoji - ? { documentId: sticker.id } as ApiReactionCustomEmoji - : { emoticon: sticker.emoji } as ApiReaction; + const reaction: ApiReaction = sticker.isCustomEmoji + ? { type: 'custom', documentId: sticker.id } + : { type: 'emoji', emoticon: sticker.emoji! }; toggleReaction({ chatId: renderedChatId, messageId: renderedMessageId, reaction, shouldAddToRecent: true, diff --git a/src/components/middle/message/reactions/Reactions.tsx b/src/components/middle/message/reactions/Reactions.tsx index f1285f3a4..716124042 100644 --- a/src/components/middle/message/reactions/Reactions.tsx +++ b/src/components/middle/message/reactions/Reactions.tsx @@ -116,7 +116,7 @@ const Reactions: FC = ({ return; } - updateMiddleSearch({ chatId: message.chatId, threadId, update: { savedTag: reaction as ApiReaction } }); + updateMiddleSearch({ chatId: message.chatId, threadId, update: { savedTag: reaction } }); performMiddleSearch({ chatId: message.chatId, threadId }); return; }