From 14de65816f96ee61911519757b5ae41a91d272a8 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 7 Apr 2025 12:27:59 -0700 Subject: [PATCH 1/4] fix invites --- app/delivery/send_to_providers.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index cecddd98b..9f0513c85 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -186,7 +186,15 @@ def send_email_to_provider(notification): personalisation = redis_store.get(f"email-personalisation-{notification.id}") if personalisation: personalisation = personalisation.decode("utf-8") - notification.personalisation = json.loads(personalisation) + p = json.loads(personalisation) + if os.get("NOTIFY_ENVIRONMENT") == "staging": + current_app.logger.info(f"Invite personalization before {p}") + p = p.replace("%5B", "") + p = p.replace("%5D", "") + if os.get("NOTIFY_ENVIRONMENT") == "staging": + current_app.logger.info(f"Invite personalization after {p}") + + notification.personalisation = p service = SerialisedService.from_id(notification.service_id) if not service.active: From d4a33549ca9120f5848892a33a702f332febd998 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 7 Apr 2025 12:37:35 -0700 Subject: [PATCH 2/4] fix invites --- app/delivery/send_to_providers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index 9f0513c85..7d0117a0a 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -187,11 +187,11 @@ def send_email_to_provider(notification): if personalisation: personalisation = personalisation.decode("utf-8") p = json.loads(personalisation) - if os.get("NOTIFY_ENVIRONMENT") == "staging": + if os.getenv("NOTIFY_ENVIRONMENT") == "staging": current_app.logger.info(f"Invite personalization before {p}") p = p.replace("%5B", "") p = p.replace("%5D", "") - if os.get("NOTIFY_ENVIRONMENT") == "staging": + if os.getenv("NOTIFY_ENVIRONMENT") == "staging": current_app.logger.info(f"Invite personalization after {p}") notification.personalisation = p From df305a815a3cb2ba91eaa548d5eacc8ddd6184a2 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 7 Apr 2025 12:45:27 -0700 Subject: [PATCH 3/4] fix invites --- app/delivery/send_to_providers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index 7d0117a0a..9dcb530f3 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -186,14 +186,14 @@ def send_email_to_provider(notification): personalisation = redis_store.get(f"email-personalisation-{notification.id}") if personalisation: personalisation = personalisation.decode("utf-8") - p = json.loads(personalisation) + if os.getenv("NOTIFY_ENVIRONMENT") == "staging": current_app.logger.info(f"Invite personalization before {p}") p = p.replace("%5B", "") p = p.replace("%5D", "") if os.getenv("NOTIFY_ENVIRONMENT") == "staging": current_app.logger.info(f"Invite personalization after {p}") - + p = json.loads(personalisation) notification.personalisation = p service = SerialisedService.from_id(notification.service_id) From b605c742622d59141128b4dbe507a1f287497e2d Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 7 Apr 2025 12:48:35 -0700 Subject: [PATCH 4/4] fix invites --- app/delivery/send_to_providers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index 9dcb530f3..3e9eb51e0 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -185,7 +185,7 @@ def send_email_to_provider(notification): recipient = recipient.decode("utf-8") personalisation = redis_store.get(f"email-personalisation-{notification.id}") if personalisation: - personalisation = personalisation.decode("utf-8") + p = personalisation.decode("utf-8") if os.getenv("NOTIFY_ENVIRONMENT") == "staging": current_app.logger.info(f"Invite personalization before {p}") @@ -193,7 +193,7 @@ def send_email_to_provider(notification): p = p.replace("%5D", "") if os.getenv("NOTIFY_ENVIRONMENT") == "staging": current_app.logger.info(f"Invite personalization after {p}") - p = json.loads(personalisation) + p = json.loads(p) notification.personalisation = p service = SerialisedService.from_id(notification.service_id)