diff --git a/ts/components/conversation/SessionQuotedMessageComposition.tsx b/ts/components/conversation/SessionQuotedMessageComposition.tsx index 4993f8474..afdbff84c 100644 --- a/ts/components/conversation/SessionQuotedMessageComposition.tsx +++ b/ts/components/conversation/SessionQuotedMessageComposition.tsx @@ -11,6 +11,7 @@ import { Image } from '../../../ts/components/conversation/Image'; // tslint:disable-next-line: no-submodule-imports import useKey from 'react-use/lib/useKey'; import { getAbsoluteAttachmentPath } from '../../types/MessageAttachment'; +import { GoogleChrome } from '../../util'; const QuotedMessageComposition = styled(Flex)` border-top: 1px solid var(--border-color); @@ -57,15 +58,26 @@ export const SessionQuotedMessageComposition = () => { hasAttachments && attachments[0].contentType !== AUDIO_MP3 && attachments[0].thumbnail ? attachments[0] : undefined; - const hasAudio = hasAttachments && isAudio(attachments); - const hasAudioAttachment = hasAudio !== false && hasAudio !== undefined && hasAudio !== ''; + const isImage = Boolean( + firstImageAttachment && GoogleChrome.isImageTypeSupported(firstImageAttachment.contentType) + ); + const isVideo = Boolean( + firstImageAttachment && GoogleChrome.isVideoTypeSupported(firstImageAttachment.contentType) + ); + const hasAudioAttachment = Boolean(hasAttachments && isAudio(attachments)); + const isGenericFile = !hasAudioAttachment && !isVideo && !isImage; + const subtitleText = - hasAttachments && firstImageAttachment - ? window.i18n('image') + quoteText !== '' + ? quoteText : hasAudioAttachment ? window.i18n('audio') - : quoteText !== '' - ? quoteText + : isGenericFile + ? window.i18n('document') + : isVideo + ? window.i18n('video') + : isImage + ? window.i18n('image') : null; const removeQuotedMessage = () => { diff --git a/ts/interactions/conversationInteractions.ts b/ts/interactions/conversationInteractions.ts index 6b4cd2898..1618ff45d 100644 --- a/ts/interactions/conversationInteractions.ts +++ b/ts/interactions/conversationInteractions.ts @@ -458,6 +458,7 @@ export async function uploadOurAvatar(newAvatarDecrypted?: ArrayBuffer) { } export async function replyToMessage(messageId: string) { + // TODO Use Quote Lookup Object here const quotedMessageModel = await Data.getMessageById(messageId); if (!quotedMessageModel) { window.log.warn('Failed to find message to reply to');