Add message import granulary on non-pro emails, group emails and received contact creation (#6156)

1) Remove featureFlag
2) Base contactCreation on messageChannel.autoContactCreationPolicy
4) add excludeProfessionalEmails + excludeGroupEmails logic
This commit is contained in:
Charles Bochet
2024-07-08 14:33:48 +02:00
committed by GitHub
parent ef849d316f
commit 9ba211055a
17 changed files with 135 additions and 147 deletions

View File

@ -9,7 +9,7 @@ export const filterEmails = (
) => {
return filterOutBlocklistedMessages(
messageChannelHandle,
filterOutIcsAttachments(filterOutNonPersonalEmails(messages)),
filterOutIcsAttachments(messages),
blocklist,
);
};
@ -46,22 +46,3 @@ const filterOutIcsAttachments = (messages: GmailMessage[]) => {
);
});
};
const isPersonEmail = (email: string): boolean => {
const nonPersonalPattern =
/noreply|no-reply|do_not_reply|no\.reply|^(info@|contact@|hello@|support@|feedback@|service@|help@|invites@|invite@|welcome@|alerts@|team@|notifications@|notification@|news@)/;
return !nonPersonalPattern.test(email);
};
const filterOutNonPersonalEmails = (messages: GmailMessage[]) => {
return messages.filter((message) => {
if (!message.participants) {
return true;
}
return message.participants.every((participant) =>
isPersonEmail(participant.handle),
);
});
};