fix: Show correct attachment type in reply ui

pull/2757/head
William Grant 2 years ago
parent 761a536b32
commit 6b2047b5c6

@ -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 = () => {

@ -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');

Loading…
Cancel
Save