Profile: Fix undefined media in the Voice tab (#4952)

This commit is contained in:
Alexander Zinchuk 2024-09-06 15:43:32 +02:00
parent b611bc409f
commit 13c6e1ab60

View File

@ -32,6 +32,7 @@ import {
getIsDownloading, getIsDownloading,
getIsSavedDialog, getIsSavedDialog,
getMessageDocument, getMessageDocument,
getMessageDownloadableMedia,
isChatAdmin, isChatAdmin,
isChatChannel, isChatChannel,
isChatGroup, isChatGroup,
@ -584,21 +585,26 @@ const Profile: FC<OwnProps & StateProps> = ({
/> />
)) ))
) : resultType === 'voice' ? ( ) : resultType === 'voice' ? (
(viewportIds as number[])!.map((id) => messagesById[id] && ( (viewportIds as number[])!.map((id) => {
<Audio const message = messagesById[id];
key={id} if (!message) return undefined;
theme={theme} const media = messagesById[id] && getMessageDownloadableMedia(message)!;
message={messagesById[id]} return messagesById[id] && (
senderTitle={getSenderName(lang, messagesById[id], chatsById, usersById)} <Audio
origin={AudioOrigin.SharedMedia} key={id}
date={messagesById[id].date} theme={theme}
className="scroll-item" message={messagesById[id]}
onPlay={handlePlayAudio} senderTitle={getSenderName(lang, messagesById[id], chatsById, usersById)}
onDateClick={handleMessageFocus} origin={AudioOrigin.SharedMedia}
canDownload={!isChatProtected && !messagesById[id].isProtected} date={messagesById[id].date}
isDownloading={getIsDownloading(activeDownloads, messagesById[id].content.voice!)} className="scroll-item"
/> onPlay={handlePlayAudio}
)) onDateClick={handleMessageFocus}
canDownload={!isChatProtected && !messagesById[id].isProtected}
isDownloading={getIsDownloading(activeDownloads, media)}
/>
);
})
) : resultType === 'members' ? ( ) : resultType === 'members' ? (
(viewportIds as string[])!.map((id, i) => ( (viewportIds as string[])!.map((id, i) => (
<ListItem <ListItem