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