6657 Refactor and fix blocklist (#6803)
Closes #6657 - Fix listeners - Refactor jobs to take array of events - Fix calendar events and messages deletion --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
import { filterOutBlocklistedEvents } from 'src/modules/calendar/calendar-event-import-manager/utils/filter-out-blocklisted-events.util';
|
||||
import { CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity';
|
||||
import { CalendarEventWithParticipants } from 'src/modules/calendar/common/types/calendar-event';
|
||||
|
||||
export const filterEventsAndReturnCancelledEvents = (
|
||||
calendarChannel: Pick<CalendarChannelWorkspaceEntity, 'handle'>,
|
||||
calendarChannelHandles: string[],
|
||||
events: CalendarEventWithParticipants[],
|
||||
blocklist: string[],
|
||||
): {
|
||||
@ -11,7 +10,7 @@ export const filterEventsAndReturnCancelledEvents = (
|
||||
cancelledEvents: CalendarEventWithParticipants[];
|
||||
} => {
|
||||
const filteredEvents = filterOutBlocklistedEvents(
|
||||
calendarChannel.handle,
|
||||
calendarChannelHandles,
|
||||
events,
|
||||
blocklist,
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@ import { isEmailBlocklisted } from 'src/modules/blocklist/utils/is-email-blockli
|
||||
import { CalendarEventWithParticipants } from 'src/modules/calendar/common/types/calendar-event';
|
||||
|
||||
export const filterOutBlocklistedEvents = (
|
||||
calendarChannelHandle: string,
|
||||
calendarChannelHandles: string[],
|
||||
events: CalendarEventWithParticipants[],
|
||||
blocklist: string[],
|
||||
) => {
|
||||
@ -13,7 +13,7 @@ export const filterOutBlocklistedEvents = (
|
||||
|
||||
return event.participants.every(
|
||||
(attendee) =>
|
||||
!isEmailBlocklisted(calendarChannelHandle, attendee.handle, blocklist),
|
||||
!isEmailBlocklisted(calendarChannelHandles, attendee.handle, blocklist),
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user