mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-24 19:41:50 -05:00
@@ -325,7 +325,14 @@ def batch_insert_notifications(self):
|
||||
elif isinstance(notification_dict["created_at"], list):
|
||||
notification_dict["created_at"] = notification_dict["created_at"][0]
|
||||
notification = Notification(**notification_dict)
|
||||
if notification is not None:
|
||||
# notify-api-749 do not write to db
|
||||
# if we have a verify_code we know this is the authentication notification at login time
|
||||
# and not csv (containing PII) provided by the user, so allow verify_code to continue to exist
|
||||
if notification is None:
|
||||
continue
|
||||
if "verify_code" in str(notification.personalisation):
|
||||
pass
|
||||
else:
|
||||
batch.append(notification)
|
||||
try:
|
||||
dao_batch_insert_notifications(batch)
|
||||
|
||||
@@ -42,12 +42,14 @@ def send_sms_to_provider(notification):
|
||||
"""
|
||||
# Take this path for report generation, where we know
|
||||
# everything is in the cache.
|
||||
personalisation = get_personalisation_from_s3(
|
||||
notification.service_id,
|
||||
notification.job_id,
|
||||
notification.job_row_number,
|
||||
)
|
||||
notification.personalisation = personalisation
|
||||
|
||||
if "verify_code" not in str(notification.personalisation):
|
||||
personalisation = get_personalisation_from_s3(
|
||||
notification.service_id,
|
||||
notification.job_id,
|
||||
notification.job_row_number,
|
||||
)
|
||||
notification.personalisation = personalisation
|
||||
|
||||
service = SerialisedService.from_id(notification.service_id)
|
||||
message_id = None
|
||||
@@ -92,7 +94,6 @@ def send_sms_to_provider(notification):
|
||||
recipient = None
|
||||
# It is our 2facode, maybe
|
||||
recipient = _get_verify_code(notification)
|
||||
|
||||
if recipient is None:
|
||||
recipient = get_phone_number_from_s3(
|
||||
notification.service_id,
|
||||
|
||||
@@ -145,6 +145,9 @@ def persist_notification(
|
||||
# it's just too hard with redis and timing to test this here
|
||||
if os.getenv("NOTIFY_ENVIRONMENT") == "test":
|
||||
dao_create_notification(notification)
|
||||
elif "verify_code" in str(notification.personalisation):
|
||||
dao_create_notification(notification)
|
||||
|
||||
else:
|
||||
redis_store.rpush(
|
||||
"message_queue",
|
||||
|
||||
Reference in New Issue
Block a user