From 2ea7e9d3f9bc21fef14d13473c3dd5e2cb205c03 Mon Sep 17 00:00:00 2001 From: Anant Bhasin <38764067+aKn1ghtOut@users.noreply.github.com> Date: Thu, 18 Mar 2021 20:14:09 +0530 Subject: [PATCH] [FIX] Attachment not rendering markdown (#2924) * [FIX] Render markdown in Fields content * Added stories Co-authored-by: Diego Mello --- .../__snapshots__/Storyshots.test.js.snap | 306 ++++++++++++++++-- app/containers/message/Reply.js | 21 +- storybook/stories/Message.js | 6 +- 3 files changed, 307 insertions(+), 26 deletions(-) diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index be964795e..84c23537a 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -39301,17 +39301,44 @@ exports[`Storyshots Message list message 1`] = ` Object { "backgroundColor": "transparent", "fontFamily": "System", - "fontSize": 14, + "fontSize": 16, "fontWeight": "400", "textAlign": "left", }, + undefined, Object { "color": "#2f343d", }, ] } > - Value 1 + + Value 1 + - Value 2 + + Value 2 + - Value 3 + + Value 3 + - Value 4 + + Value 4 + - Value 5 + + Value 5 + @@ -39541,7 +39676,7 @@ exports[`Storyshots Message list message 1`] = ` ] } > - Two short custom fields + Two short custom fields with markdown - Value 1 + + Value 1 + - Value 2 + + + Value 2 + + @@ -40191,17 +40402,44 @@ exports[`Storyshots Message list message 1`] = ` Object { "backgroundColor": "transparent", "fontFamily": "System", - "fontSize": 14, + "fontSize": 16, "fontWeight": "400", "textAlign": "left", }, + undefined, Object { "color": "#2f343d", }, ] } > - Value 1 + + Value 1 + - Value 2 + + Value 2 + diff --git a/app/containers/message/Reply.js b/app/containers/message/Reply.js index d05668ddb..caa80039a 100644 --- a/app/containers/message/Reply.js +++ b/app/containers/message/Reply.js @@ -112,16 +112,24 @@ const Description = React.memo(({ return true; }); -const Fields = React.memo(({ attachment, theme }) => { +const Fields = React.memo(({ attachment, theme, getCustomEmoji }) => { if (!attachment.fields) { return null; } + + const { baseUrl, user } = useContext(MessageContext); return ( {attachment.fields.map(field => ( {field.title} - {field.value} + ))} @@ -176,7 +184,11 @@ const Reply = React.memo(({ getCustomEmoji={getCustomEmoji} theme={theme} /> - + { }]} /> - + { short: true }, { title: 'Field 2', - value: 'Value 2', + value: '[Value 2](https://google.com/)', short: true }] }, { @@ -734,7 +734,7 @@ export default ({ theme }) => { short: true }, { title: 'Field 2', - value: 'Value 2', + value: '**Value 2**', short: true }] }]}