From 28ab90857c473eb9174ee6dd1454dce00650f484 Mon Sep 17 00:00:00 2001 From: Anant Bhasin <38764067+aKn1ghtOut@users.noreply.github.com> Date: Fri, 2 Apr 2021 02:36:50 +0530 Subject: [PATCH] [FIX] Non-reply attachments displaying time (#2902) * Remove time if no message_link * Fix message stories for replies * Final stories fix Co-authored-by: Diego Mello --- app/containers/message/Reply.js | 2 +- storybook/stories/Message.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/containers/message/Reply.js b/app/containers/message/Reply.js index 698eec945..4acecbc42 100644 --- a/app/containers/message/Reply.js +++ b/app/containers/message/Reply.js @@ -73,7 +73,7 @@ const Title = React.memo(({ attachment, timeFormat, theme }) => { if (!attachment.author_name) { return null; } - const time = attachment.ts ? moment(attachment.ts).format(timeFormat) : null; + const time = attachment.message_link && attachment.ts ? moment(attachment.ts).format(timeFormat) : null; return ( {attachment.author_name ? {attachment.author_name} : null} diff --git a/storybook/stories/Message.js b/storybook/stories/Message.js index f33f69cfd..5fc6663d0 100644 --- a/storybook/stories/Message.js +++ b/storybook/stories/Message.js @@ -440,7 +440,8 @@ export default ({ theme }) => { author_name: 'I\'m a very long long title and I\'ll break', ts: date, timeFormat: 'LT', - text: 'How are you?' + text: 'How are you?', + message_link: 'http:///example.com' }]} /> { author_name: 'rocket.cat', ts: date, timeFormat: 'LT', - text: 'How are you? :nyan_rocket:' + text: 'How are you? :nyan_rocket:', + message_link: 'http:///example.com' }]} /> @@ -702,6 +704,7 @@ export default ({ theme }) => { ts: date, timeFormat: 'LT', text: 'Custom fields', + message_link: 'http:///example.com', fields: [{ title: 'Field 1', value: 'Value 1' @@ -729,6 +732,7 @@ export default ({ theme }) => { ts: date, timeFormat: 'LT', text: 'Custom fields', + message_link: 'http:///example.com', fields: [{ title: 'Field 1', value: 'Value 1', @@ -743,6 +747,7 @@ export default ({ theme }) => { ts: date, timeFormat: 'LT', text: 'Custom fields 2', + message_link: 'http:///example.com', fields: [{ title: 'Field 1', value: 'Value 1', @@ -833,6 +838,7 @@ export default ({ theme }) => { author_name: 'rocket.cat', ts: date, timeFormat: 'LT', + message_link: 'http:///example.com', text: 'First message' }]} />