mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Revert "Revert "Merge pull request #2887 from alphagov/cache-the-serialised-things""
This reverts commit 7e85e37e1d.
This commit is contained in:
@@ -137,7 +137,9 @@ def get_reply_to_text(notification_type, sender_id, service, template):
|
||||
def send_pdf_letter_notification(service_id, post_data):
|
||||
service = dao_fetch_service_by_id(service_id)
|
||||
|
||||
check_service_has_permission(LETTER_TYPE, service.permissions)
|
||||
check_service_has_permission(LETTER_TYPE, [
|
||||
p.permission for p in service.permissions
|
||||
])
|
||||
check_service_over_daily_message_limit(KEY_TYPE_NORMAL, service)
|
||||
validate_created_by(service, post_data['created_by'])
|
||||
validate_and_format_recipient(
|
||||
|
||||
@@ -7,6 +7,8 @@ from app.models import (
|
||||
MOBILE_TYPE, EMAIL_TYPE,
|
||||
KEY_TYPE_TEST, KEY_TYPE_TEAM, KEY_TYPE_NORMAL)
|
||||
|
||||
from app.dao.services_dao import dao_fetch_service_by_id
|
||||
|
||||
|
||||
def get_recipients_from_request(request_json, key, type):
|
||||
return [(type, recipient) for recipient in request_json.get(key)]
|
||||
@@ -33,6 +35,10 @@ def service_allowed_to_send_to(recipient, service, key_type, allow_whitelisted_r
|
||||
if key_type == KEY_TYPE_NORMAL and not service.restricted:
|
||||
return True
|
||||
|
||||
# Revert back to the ORM model here so we can get some things which
|
||||
# aren’t in the serialised model
|
||||
service = dao_fetch_service_by_id(service.id)
|
||||
|
||||
team_members = itertools.chain.from_iterable(
|
||||
[user.mobile_number, user.email_address] for user in service.users
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user