We should not enqueue jobs "unmatch participants" with empty email.

This was done because of deleting persons while persons may have empty
emails

Fixes https://github.com/twentyhq/twenty/issues/13462
This commit is contained in:
Guillim
2025-07-28 13:56:20 +02:00
committed by GitHub
parent ae47157818
commit 400dd6d969

View File

@ -129,7 +129,9 @@ export class CalendarEventParticipantPersonListener {
const { addedAdditionalEmails, removedAdditionalEmails } =
computeChangedAdditionalEmails(eventPayload.properties.diff);
const removedEmailPromises = removedAdditionalEmails.map((email) =>
const removedEmailPromises = removedAdditionalEmails
?.filter((email: string) => isDefined(email))
.map((email) =>
this.messageQueueService.add<CalendarEventParticipantUnmatchParticipantJobData>(
CalendarEventParticipantUnmatchParticipantJob.name,
{
@ -166,6 +168,7 @@ export class CalendarEventParticipantPersonListener {
>,
) {
for (const eventPayload of payload.events) {
if (isDefined(eventPayload.properties.before.emails?.primaryEmail)) {
await this.messageQueueService.add<CalendarEventParticipantUnmatchParticipantJobData>(
CalendarEventParticipantUnmatchParticipantJob.name,
{
@ -174,12 +177,15 @@ export class CalendarEventParticipantPersonListener {
personId: eventPayload.recordId,
},
);
}
const additionalEmails =
eventPayload.properties.before.emails?.additionalEmails;
if (Array.isArray(additionalEmails)) {
const additionalEmailPromises = additionalEmails.map((email) =>
const additionalEmailPromises = additionalEmails
?.filter((email: string) => isDefined(email))
.map((email) =>
this.messageQueueService.add<CalendarEventParticipantUnmatchParticipantJobData>(
CalendarEventParticipantUnmatchParticipantJob.name,
{