From b2d06ff289edb6cec6cf509bf3f3ed3e5362c222 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 25 Jan 2022 03:24:31 +0100 Subject: [PATCH] Discussions: Fix missing reactions and Send As feature (#1662) --- src/components/middle/composer/Composer.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/middle/composer/Composer.tsx b/src/components/middle/composer/Composer.tsx index 8d4769816..291bb5f75 100644 --- a/src/components/middle/composer/Composer.tsx +++ b/src/components/middle/composer/Composer.tsx @@ -225,6 +225,7 @@ const Composer: FC = ({ addRecentEmoji, sendInlineBotResult, loadSendAs, + loadFullChat, } = getDispatch(); const lang = useLang(); @@ -240,6 +241,7 @@ const Composer: FC = ({ ] = useState(); const { width: windowWidth } = windowSize.get(); const sendAsIds = chat?.sendAsIds; + const canShowSendAs = sendAsIds && (sendAsIds.length > 1 || !sendAsIds.includes(currentUserId!)); const sendMessageAction = useSendMessageAction(chatId, threadId); useEffect(() => { @@ -258,6 +260,12 @@ const Composer: FC = ({ } }, [chat, chatId, isReady, lastSyncTime, loadSendAs, sendAsIds]); + useEffect(() => { + if (chatId && chat && lastSyncTime && !chat.fullInfo && isReady && isChatSuperGroup(chat)) { + loadFullChat({ chatId }); + } + }, [chat, chatId, isReady, lastSyncTime, loadFullChat]); + const shouldAnimateSendAsButtonRef = useRef(false); useOnChange(([prevChatId, prevSendAsIds]) => { // We only animate send-as button if `sendAsIds` was missing when opening the chat @@ -920,7 +928,7 @@ const Composer: FC = ({ )} - {!!sendAsIds?.length && (sendAsUser || sendAsChat) && ( + {canShowSendAs && (sendAsUser || sendAsChat) && (