mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
@@ -3,8 +3,8 @@ import itertools
|
||||
from notifications_utils.recipients import allowed_to_send_to
|
||||
|
||||
from app.dao.services_dao import dao_fetch_service_by_id
|
||||
from app.enums import RecipientType
|
||||
from app.models import KEY_TYPE_NORMAL, KEY_TYPE_TEAM, KEY_TYPE_TEST, ServiceGuestList
|
||||
from app.enums import RecipientType, KeyType
|
||||
from app.models import ServiceGuestList
|
||||
|
||||
|
||||
def get_recipients_from_request(request_json, key, type):
|
||||
@@ -28,10 +28,10 @@ def get_guest_list_objects(service_id, request_json):
|
||||
def service_allowed_to_send_to(
|
||||
recipient, service, key_type, allow_guest_list_recipients=True
|
||||
):
|
||||
if key_type == KEY_TYPE_TEST:
|
||||
if key_type == KeyType.TEST:
|
||||
return True
|
||||
|
||||
if key_type == KEY_TYPE_NORMAL and not service.restricted:
|
||||
if key_type == KeyType.NORMAL and not service.restricted:
|
||||
return True
|
||||
|
||||
# Revert back to the ORM model here so we can get some things which
|
||||
@@ -45,8 +45,8 @@ def service_allowed_to_send_to(
|
||||
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 == KeyType.NORMAL and service.restricted) or (
|
||||
key_type == KeyType.TEAM
|
||||
):
|
||||
return allowed_to_send_to(
|
||||
recipient, itertools.chain(team_members, guest_list_members)
|
||||
|
||||
Reference in New Issue
Block a user