From 1bb99ac3df2786f4961673d04dd5d5cdaa251413 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 26 Nov 2020 16:05:07 +1100 Subject: [PATCH] enable back media switch on lightbox opened from a message with several attachments --- .../session/conversation/SessionConversation.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ts/components/session/conversation/SessionConversation.tsx b/ts/components/session/conversation/SessionConversation.tsx index 213ddb9b0..de127a5e5 100644 --- a/ts/components/session/conversation/SessionConversation.tsx +++ b/ts/components/session/conversation/SessionConversation.tsx @@ -852,14 +852,15 @@ export class SessionConversation extends React.Component { } private onClickAttachment(attachment: any, message: any) { + const media = (message.attachments || []).map((attachmentForMedia: any) => { + return { + objectURL: attachmentForMedia.url, + contentType: attachmentForMedia.contentType, + attachment: attachmentForMedia, + }; + }); const lightBoxOptions = { - media: [ - { - objectURL: attachment.url, - contentType: attachment.contentType, - attachment, - }, - ], + media, attachment, }; this.setState({ lightBoxOptions });