mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
reformat
This commit is contained in:
@@ -13,26 +13,30 @@ from app.notifications.process_notifications import (
|
||||
)
|
||||
|
||||
|
||||
def send_notification_to_service_users(service_id, template_id, personalisation=None, include_user_fields=None):
|
||||
def send_notification_to_service_users(
|
||||
service_id, template_id, personalisation=None, include_user_fields=None
|
||||
):
|
||||
personalisation = personalisation or {}
|
||||
include_user_fields = include_user_fields or []
|
||||
template = dao_get_template_by_id(template_id)
|
||||
service = dao_fetch_service_by_id(service_id)
|
||||
active_users = dao_fetch_active_users_for_service(service.id)
|
||||
notify_service = dao_fetch_service_by_id(current_app.config['NOTIFY_SERVICE_ID'])
|
||||
notify_service = dao_fetch_service_by_id(current_app.config["NOTIFY_SERVICE_ID"])
|
||||
|
||||
for user in active_users:
|
||||
personalisation = _add_user_fields(user, personalisation, include_user_fields)
|
||||
notification = persist_notification(
|
||||
template_id=template.id,
|
||||
template_version=template.version,
|
||||
recipient=user.email_address if template.template_type == EMAIL_TYPE else user.mobile_number,
|
||||
recipient=user.email_address
|
||||
if template.template_type == EMAIL_TYPE
|
||||
else user.mobile_number,
|
||||
service=notify_service,
|
||||
personalisation=personalisation,
|
||||
notification_type=template.template_type,
|
||||
api_key_id=None,
|
||||
key_type=KEY_TYPE_NORMAL,
|
||||
reply_to_text=notify_service.get_default_reply_to_email_address()
|
||||
reply_to_text=notify_service.get_default_reply_to_email_address(),
|
||||
)
|
||||
send_notification_to_queue(notification, queue=QueueNames.NOTIFY)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user