5629 update blocklist for messaging v2 (#5756)

Closes #5629 

- Add subdomain support in blocklist (if @example.com is blocked, every
subdomain will be blocked)
This commit is contained in:
bosiraphael
2024-06-13 07:53:28 +02:00
committed by GitHub
parent 374237a988
commit f825bea071
11 changed files with 165 additions and 113 deletions

View File

@ -3,6 +3,7 @@ import { calendar_v3 as calendarV3 } from 'googleapis';
import { isEmailBlocklisted } from 'src/modules/calendar-messaging-participant/utils/is-email-blocklisted.util';
export const filterOutBlocklistedEvents = (
calendarChannelHandle: string,
events: calendarV3.Schema$Event[],
blocklist: string[],
) => {
@ -12,7 +13,8 @@ export const filterOutBlocklistedEvents = (
}
return event.attendees.every(
(attendee) => !isEmailBlocklisted(attendee.email, blocklist),
(attendee) =>
!isEmailBlocklisted(calendarChannelHandle, attendee.email, blocklist),
);
});
};