This commit is contained in:
Kenneth Kehl
2023-08-29 14:54:30 -07:00
parent 19dcd7a48b
commit 1ecb747c6d
588 changed files with 34100 additions and 23589 deletions

View File

@@ -21,17 +21,15 @@ def get_guest_list_objects(service_id, request_json):
return [
ServiceGuestList.from_string(service_id, type, recipient)
for type, recipient in (
get_recipients_from_request(request_json,
'phone_numbers',
MOBILE_TYPE) +
get_recipients_from_request(request_json,
'email_addresses',
EMAIL_TYPE)
get_recipients_from_request(request_json, "phone_numbers", MOBILE_TYPE)
+ get_recipients_from_request(request_json, "email_addresses", EMAIL_TYPE)
)
]
def service_allowed_to_send_to(recipient, service, key_type, allow_guest_list_recipients=True):
def service_allowed_to_send_to(
recipient, service, key_type, allow_guest_list_recipients=True
):
if key_type == KEY_TYPE_TEST:
return True
@@ -46,18 +44,12 @@ def service_allowed_to_send_to(recipient, service, key_type, allow_guest_list_re
[user.mobile_number, user.email_address] for user in service.users
)
guest_list_members = [
member.recipient for member in service.guest_list
if allow_guest_list_recipients
member.recipient for member in service.guest_list if allow_guest_list_recipients
]
if (
(key_type == KEY_TYPE_NORMAL and service.restricted) or
(key_type == KEY_TYPE_TEAM)
if (key_type == KEY_TYPE_NORMAL and service.restricted) or (
key_type == KEY_TYPE_TEAM
):
return allowed_to_send_to(
recipient,
itertools.chain(
team_members,
guest_list_members
)
recipient, itertools.chain(team_members, guest_list_members)
)