fix: Save content_type, multipart information to email message model (#2774)

This commit is contained in:
Pranav Raj S
2021-08-09 18:04:34 +05:30
committed by GitHub
parent 462214aced
commit bdc4ecffc1
5 changed files with 40 additions and 14 deletions

View File

@@ -143,6 +143,7 @@ export default {
const {
email: {
content_type: contentType = '',
html_content: { full: fullHTMLContent, reply: replyHTMLContent } = {},
text_content: { full: fullTextContent, reply: replyTextContent } = {},
} = {},
@@ -156,7 +157,12 @@ export default {
if (contentToBeParsed && this.isIncoming) {
const parsedContent = this.stripStyleCharacters(contentToBeParsed);
if (parsedContent) {
return parsedContent.replace(/\n/g, '<br />');
// This is a temporary fix for line-breaks in text/plain emails
// Now, It is not rendered properly in the email preview.
// FIXME: Remove this once we have a better solution for rendering text/plain emails
return contentType.includes('text/plain')
? parsedContent.replace(/\n/g, '<br />')
: parsedContent;
}
}
return (

View File

@@ -61,17 +61,19 @@ class MailPresenter < SimpleDelegator
def serialized_data
{
text_content: text_content,
bcc: bcc,
cc: cc,
content_type: content_type,
date: date,
from: from,
html_content: html_content,
in_reply_to: in_reply_to,
message_id: message_id,
multipart: multipart?,
number_of_attachments: number_of_attachments,
subject: subject,
date: date,
to: to,
from: from,
in_reply_to: in_reply_to,
cc: cc,
bcc: bcc,
message_id: message_id
text_content: text_content,
to: to
}
end