From 9f9a9b71a4332b7820bfbe267067c48bfaf27877 Mon Sep 17 00:00:00 2001 From: Diego Mello <diegolmello@gmail.com> Date: Tue, 21 Aug 2018 16:37:15 -0300 Subject: [PATCH] [FIX] Only single attachment rendered (#417) --- app/containers/message/index.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app/containers/message/index.js b/app/containers/message/index.js index a431f54c2..96910f671 100644 --- a/app/containers/message/index.js +++ b/app/containers/message/index.js @@ -241,19 +241,20 @@ export default class Message extends React.Component { return null; } - const file = this.props.item.attachments[0]; - const { user } = this.props; - if (file.image_url) { - return <Image file={file} user={user} />; - } - if (file.audio_url) { - return <Audio file={file} user={user} />; - } - if (file.video_url) { - return <Video file={file} user={user} />; - } - - return <Reply attachment={file} timeFormat={this.timeFormat} />; + return this.props.item.attachments.map((file) => { + const { user } = this.props; + if (file.image_url) { + return <Image file={file} user={user} />; + } + if (file.audio_url) { + return <Audio file={file} user={user} />; + } + if (file.video_url) { + return <Video file={file} user={user} />; + } + + return <Reply attachment={file} timeFormat={this.timeFormat} />; + }); } renderUrl = () => { -- GitLab