mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-26 13:31:45 +03:00
Remove html from messages (#4229)
* remove html * remove html * remove html from db
This commit is contained in:
parent
f52a4141c9
commit
8c08f1b603
@ -212,7 +212,7 @@ export class MessageService {
|
|||||||
const receivedAt = new Date(parseInt(message.internalDate));
|
const receivedAt = new Date(parseInt(message.internalDate));
|
||||||
|
|
||||||
await manager.query(
|
await manager.query(
|
||||||
`INSERT INTO ${dataSourceMetadata.schema}."message" ("id", "headerMessageId", "subject", "receivedAt", "direction", "messageThreadId", "text", "html") VALUES ($1, $2, $3, $4, $5, $6, $7, $8)`,
|
`INSERT INTO ${dataSourceMetadata.schema}."message" ("id", "headerMessageId", "subject", "receivedAt", "direction", "messageThreadId", "text") VALUES ($1, $2, $3, $4, $5, $6, $7)`,
|
||||||
[
|
[
|
||||||
newMessageId,
|
newMessageId,
|
||||||
message.headerMessageId,
|
message.headerMessageId,
|
||||||
@ -221,7 +221,6 @@ export class MessageService {
|
|||||||
messageDirection,
|
messageDirection,
|
||||||
messageThreadId,
|
messageThreadId,
|
||||||
message.text,
|
message.text,
|
||||||
message.html,
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -199,19 +199,15 @@ export class FetchMessagesByBatchesService {
|
|||||||
const body = atob(raw?.replace(/-/g, '+').replace(/_/g, '/'));
|
const body = atob(raw?.replace(/-/g, '+').replace(/_/g, '/'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const parsed = await simpleParser(body);
|
const parsed = await simpleParser(body, {
|
||||||
|
skipHtmlToText: true,
|
||||||
|
skipImageLinks: true,
|
||||||
|
skipTextToHtml: true,
|
||||||
|
maxHtmlLengthToParse: 0,
|
||||||
|
});
|
||||||
|
|
||||||
const {
|
const { subject, messageId, from, to, cc, bcc, text, attachments } =
|
||||||
subject,
|
parsed;
|
||||||
messageId,
|
|
||||||
from,
|
|
||||||
to,
|
|
||||||
cc,
|
|
||||||
bcc,
|
|
||||||
text,
|
|
||||||
html,
|
|
||||||
attachments,
|
|
||||||
} = parsed;
|
|
||||||
|
|
||||||
if (!from) throw new Error('From value is missing');
|
if (!from) throw new Error('From value is missing');
|
||||||
|
|
||||||
@ -248,7 +244,6 @@ export class FetchMessagesByBatchesService {
|
|||||||
fromDisplayName: from.value[0].name || '',
|
fromDisplayName: from.value[0].name || '',
|
||||||
participants,
|
participants,
|
||||||
text: textWithoutReplyQuotations || '',
|
text: textWithoutReplyQuotations || '',
|
||||||
html: html || '',
|
|
||||||
attachments,
|
attachments,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ export type GmailMessage = {
|
|||||||
fromDisplayName: string;
|
fromDisplayName: string;
|
||||||
participants: Participant[];
|
participants: Participant[];
|
||||||
text: string;
|
text: string;
|
||||||
html: string;
|
|
||||||
attachments: Attachment[];
|
attachments: Attachment[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,14 +69,6 @@ export class MessageObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
text: string;
|
text: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'Html',
|
|
||||||
description: 'Html',
|
|
||||||
icon: 'IconMessage',
|
|
||||||
})
|
|
||||||
html: string;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
@FieldMetadata({
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Received At',
|
label: 'Received At',
|
||||||
|
Loading…
Reference in New Issue
Block a user