Audio: Remove download button in protected chats (#1960)

This commit is contained in:
Alexander Zinchuk 2022-07-20 16:02:11 +02:00
parent fc4e84ac40
commit c772a7b2eb
4 changed files with 7 additions and 1 deletions

View File

@ -57,6 +57,7 @@ type OwnProps = {
isDownloading: boolean;
isTranscribing?: boolean;
isTranscribed?: boolean;
canDownload?: boolean;
canTranscribe?: boolean;
isTranscriptionHidden?: boolean;
isTranscriptionError?: boolean;
@ -92,6 +93,7 @@ const Audio: FC<OwnProps> = ({
isTranscriptionHidden,
isTranscribed,
isTranscriptionError,
canDownload,
canTranscribe,
onHideTranscription,
onPlay,
@ -365,7 +367,7 @@ const Audio: FC<OwnProps> = ({
/>
</div>
)}
{audio && !isUploading && (
{audio && canDownload && !isUploading && (
<Button
round
size="tiny"

View File

@ -104,6 +104,7 @@ const AudioResults: FC<OwnProps & StateProps> = ({
className="scroll-item"
onPlay={handlePlayAudio}
onDateClick={handleMessageFocus}
canDownload={!chatsById[message.chatId]?.isProtected && !message.isProtected}
isDownloading={activeDownloads[message.chatId]?.includes(message.id)}
/>
</div>

View File

@ -772,6 +772,7 @@ const Message: FC<OwnProps & StateProps> = ({
isTranscriptionHidden={isTranscriptionHidden}
isTranscribed={Boolean(transcribedText)}
isTranscriptionError={isTranscriptionError}
canDownload={!isProtected}
onHideTranscription={setTranscriptionHidden}
canTranscribe={isPremium}
/>

View File

@ -389,6 +389,7 @@ const Profile: FC<OwnProps & StateProps> = ({
className="scroll-item"
onPlay={handlePlayAudio}
onDateClick={handleMessageFocus}
canDownload={!isChatProtected && !chatMessages[id].isProtected}
isDownloading={activeDownloadIds.includes(id)}
/>
))
@ -405,6 +406,7 @@ const Profile: FC<OwnProps & StateProps> = ({
className="scroll-item"
onPlay={handlePlayAudio}
onDateClick={handleMessageFocus}
canDownload={!isChatProtected && !chatMessages[id].isProtected}
isDownloading={activeDownloadIds.includes(id)}
/>
))