From ef606204a2145fc930d57579d7f58262c31a52fc Mon Sep 17 00:00:00 2001 From: Pranav Date: Tue, 18 Jun 2024 21:10:41 -0700 Subject: [PATCH] fix: Temporarily fix text/plain email rendering (#9653) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is hacky fix for plain text email rendering. The issue happens only for the text/plain only emails. If there was an HTML component, then the rendering works fine. **How was this tested?** Mac Email client allows you to send text/plain emails. I've sent one to myself and imported it on Chatwoot. I've also verified that the email contains only text/plain part. Sample rendered email below. Screenshot 2024-06-18 at 8 15 10 PM Fixes https://github.com/chatwoot/chatwoot/issues/9649 Fixes https://github.com/chatwoot/chatwoot/issues/9480 --- .../components/widgets/conversation/Message.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/components/widgets/conversation/Message.vue b/app/javascript/dashboard/components/widgets/conversation/Message.vue index fc80b871c..63ab5643f 100644 --- a/app/javascript/dashboard/components/widgets/conversation/Message.vue +++ b/app/javascript/dashboard/components/widgets/conversation/Message.vue @@ -257,7 +257,16 @@ export default { html_content: { full: fullHTMLContent } = {}, text_content: { full: fullTextContent } = {}, } = this.contentAttributes.email || {}; - return fullHTMLContent || fullTextContent || ''; + + if (fullHTMLContent) { + return fullHTMLContent; + } + + if (fullTextContent) { + return fullTextContent.replace(/\n/g, '
'); + } + + return ''; }, displayQuotedButton() { if (this.emailMessageContent.includes('