diff --git a/.ds.baseline b/.ds.baseline index 85c0f6ad1..0ded707f2 100644 --- a/.ds.baseline +++ b/.ds.baseline @@ -684,5 +684,5 @@ } ] }, - "generated_at": "2025-01-15T20:07:34Z" + "generated_at": "2025-01-16T16:38:48Z" } diff --git a/app/assets/sass/uswds/_legacy-styles.scss b/app/assets/sass/uswds/_legacy-styles.scss index 85da17321..4af2cc6f6 100644 --- a/app/assets/sass/uswds/_legacy-styles.scss +++ b/app/assets/sass/uswds/_legacy-styles.scss @@ -8,7 +8,7 @@ width: 100%; max-width: 464px; box-sizing: border-box; - padding: units(1); + padding: units(2); background: color('gray-cool-10'); border: 1px solid color('gray-cool-10'); border-radius: 5px; diff --git a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss index 0bb1aab7e..7fafb8276 100644 --- a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss +++ b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss @@ -1024,3 +1024,7 @@ nav.nav { font-size: units(3); font-weight: bold; } + +.form-control-error { + border: 4px solid #b10e1e +} diff --git a/app/main/views/index.py b/app/main/views/index.py index 51c865b81..8b63d2bd8 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -300,6 +300,13 @@ def studio(): ) +@main.route("/acceptable-use-policy") +def acceptable_use_policy(): + return render_template( + "views/acceptable-use-policy.html", + ) + + # --- Redirects --- # diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 5c59e1e7c..3a7315db7 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -645,6 +645,7 @@ def edit_service_template(service_id, template_id): return render_template( "views/edit-{}-template.html".format(template["template_type"]), form=form, + errors=form.errors if form.errors else None, template=template, heading_action="Edit", ) diff --git a/app/notify_client/billing_api_client.py b/app/notify_client/billing_api_client.py index a6226f14a..b1ffc19f0 100644 --- a/app/notify_client/billing_api_client.py +++ b/app/notify_client/billing_api_client.py @@ -1,3 +1,6 @@ +import json + +from app.extensions import redis_client from app.notify_client import NotifyAdminAPIClient @@ -15,10 +18,19 @@ class BillingAPIClient(NotifyAdminAPIClient): ) def get_free_sms_fragment_limit_for_year(self, service_id, year=None): + frag_limit = redis_client.get(f"free-sms-fragment-limit-{service_id}-{year}") + if frag_limit is not None: + return json.loads(frag_limit.decode("utf-8")) result = self.get( "/service/{0}/billing/free-sms-fragment-limit".format(service_id), params=dict(financial_year_start=year), ) + + redis_client.set( + f"free-sms-fragment-limit-{service_id}-{year}", + json.dumps(result["free_sms_fragment_limit"]), + ex=30, + ) return result["free_sms_fragment_limit"] def create_or_update_free_sms_fragment_limit( diff --git a/app/notify_client/service_api_client.py b/app/notify_client/service_api_client.py index 3a0655d9e..0229fee3d 100644 --- a/app/notify_client/service_api_client.py +++ b/app/notify_client/service_api_client.py @@ -1,3 +1,4 @@ +import json from datetime import datetime, timezone from app.extensions import redis_client @@ -517,7 +518,18 @@ class ServiceAPIClient(NotifyAdminAPIClient): return int(count) def get_global_notification_count(self, service_id): - return self.get("/service/{}/notification-count".format(service_id)) + notification_count = redis_client.get(f"notification-count-{service_id}") + if notification_count is not None: + return json.loads(notification_count.decode("utf-8")) + + notification_count = self.get( + "/service/{}/notification-count".format(service_id) + ) + redis_client.set( + f"notification-count-{service_id}", json.dumps(notification_count), ex=30 + ) + + return notification_count def get_service_invite_data(self, redis_key): """ diff --git a/app/templates/components/components/input/template.njk b/app/templates/components/components/input/template.njk index 7f5634651..9e2cff08c 100644 --- a/app/templates/components/components/input/template.njk +++ b/app/templates/components/components/input/template.njk @@ -42,5 +42,7 @@ {%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %} {%- if params.autocomplete %} autocomplete="{{ params.autocomplete}}"{% endif %} {%- if params.pattern %} pattern="{{ params.pattern }}"{% endif %} - {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}> + {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%} + {%- if params.required %} required{% endif %} +/> diff --git a/app/templates/components/footer.html b/app/templates/components/footer.html index d7aa2bf1a..0de0b5fc9 100644 --- a/app/templates/components/footer.html +++ b/app/templates/components/footer.html @@ -54,6 +54,9 @@ Performance reports +