fix: Handle rendering HTML only email in UI (#1987)
This commit is contained in:
parent
8612f307b3
commit
8285f5df15
2 changed files with 25 additions and 5 deletions
|
@ -143,7 +143,9 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
parsedLastMessage() {
|
parsedLastMessage() {
|
||||||
return this.getPlainText(this.lastMessageInChat.content);
|
const { content_attributes: contentAttributes } = this.lastMessageInChat;
|
||||||
|
const { email: { subject } = {} } = contentAttributes || {};
|
||||||
|
return this.getPlainText(subject || this.lastMessageInChat.content);
|
||||||
},
|
},
|
||||||
|
|
||||||
chatInbox() {
|
chatInbox() {
|
||||||
|
|
|
@ -107,11 +107,23 @@ export default {
|
||||||
this.contentAttributes,
|
this.contentAttributes,
|
||||||
this.$t('CONVERSATION.NO_RESPONSE')
|
this.$t('CONVERSATION.NO_RESPONSE')
|
||||||
);
|
);
|
||||||
let messageContent =
|
|
||||||
this.formatMessage(this.data.content, this.isATweet) +
|
|
||||||
botMessageContent;
|
|
||||||
|
|
||||||
return messageContent;
|
const {
|
||||||
|
email: { html_content: { full: fullHTMLContent } = {} } = {},
|
||||||
|
} = this.contentAttributes;
|
||||||
|
|
||||||
|
if (fullHTMLContent && this.isIncoming) {
|
||||||
|
let parsedContent = new DOMParser().parseFromString(
|
||||||
|
fullHTMLContent || '',
|
||||||
|
'text/html'
|
||||||
|
);
|
||||||
|
if (!parsedContent.getElementsByTagName('parsererror').length) {
|
||||||
|
return parsedContent.body.innerHTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
this.formatMessage(this.data.content, this.isATweet) + botMessageContent
|
||||||
|
);
|
||||||
},
|
},
|
||||||
contentAttributes() {
|
contentAttributes() {
|
||||||
return this.data.content_attributes || {};
|
return this.data.content_attributes || {};
|
||||||
|
@ -261,4 +273,10 @@ export default {
|
||||||
margin-left: var(--space-smaller);
|
margin-left: var(--space-smaller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is a hack to hide quoted content from GMAIL
|
||||||
|
// Replace this with actual content parser
|
||||||
|
.gmail_quote {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue