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:
@ -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),
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user