mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
fix broken go live email notification
This commit is contained in:
@@ -14,7 +14,6 @@ from app.notifications.process_notifications import (
|
||||
persist_notification,
|
||||
send_notification_to_queue,
|
||||
)
|
||||
from app.utils import hilite
|
||||
|
||||
|
||||
def send_notification_to_service_users(
|
||||
@@ -25,12 +24,10 @@ def send_notification_to_service_users(
|
||||
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)
|
||||
print(hilite(f"ACTIVE USERS ARE {active_users}"))
|
||||
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)
|
||||
print(hilite(f"PERSONALISATION IS {personalisation}"))
|
||||
notification = persist_notification(
|
||||
template_id=template.id,
|
||||
template_version=template.version,
|
||||
@@ -46,17 +43,14 @@ def send_notification_to_service_users(
|
||||
key_type=KeyType.NORMAL,
|
||||
reply_to_text=notify_service.get_default_reply_to_email_address(),
|
||||
)
|
||||
print(hilite(f"NOTIFICATION IS {notification.serialize_for_csv()}"))
|
||||
redis_store.set(
|
||||
f"email-personalisation-{notification.id}",
|
||||
json.dumps(personalisation),
|
||||
ex=24 * 60 * 60,
|
||||
)
|
||||
print(hilite("GOT PAST FIRST SET"))
|
||||
redis_store.set(
|
||||
f"email-recipient-{notification.id}", notification.to, ex=24 * 60 * 60
|
||||
)
|
||||
print(hilite("GOT PAST SECOND SET"))
|
||||
|
||||
send_notification_to_queue(notification, queue=QueueNames.NOTIFY)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user