From c74ab6ff2707bf12990fd4a495a107d132fcc5b3 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 27 Nov 2023 14:49:20 -0800 Subject: [PATCH 01/38] fix flake8 --- app/main/views/templates.py | 18 ++++++++++++++++-- app/templates/views/edit-sms-template.html | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 87f32b60fa..40c1d91d17 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -503,6 +503,8 @@ def delete_template_folder(service_id, template_folder_id): ) @user_has_permissions("manage_templates") def add_service_template(service_id, template_type, template_folder_id=None): + + print("ENTER ADD_SERVICE_TEMPLATE") if template_type not in current_service.available_template_types: return redirect( url_for( @@ -567,6 +569,7 @@ def abort_403_if_not_admin_user(): ) @user_has_permissions("manage_templates") def edit_service_template(service_id, template_id): + print("ENTER EDIT_SERVICE_TEMPLATE") template = current_service.get_template_with_user_permission_or_403( template_id, current_user ) @@ -667,6 +670,7 @@ def count_content_length(service_id, template_type): current_service, ) ) + print(f"ERROR AND MESSAGE {error} {message}") return jsonify( { @@ -681,6 +685,16 @@ def count_content_length(service_id, template_type): def _get_content_count_error_and_message_for_template(template): if template.template_type == "sms": + + islatin1 = lambda s: bool(s.encode(encoding="latin-1", errors="strict")) + warning = "" + try: + islatin1(template.content) + except UnicodeEncodeError: + warning = " Use of characters outside the iso-latin-1 character set will result in additional characters and may not display properly on older phones." + + + if template.is_message_too_long(): return True, ( f"You have " @@ -690,10 +704,10 @@ def _get_content_count_error_and_message_for_template(template): if template.placeholders: return False, ( f"Will be charged as {message_count(template.fragment_count, template.template_type)} " - f"(not including personalization)" + f"(not including personalization). {warning}" ) return False, ( - f"Will be charged as {message_count(template.fragment_count, template.template_type)} " + f"Will be charged as {message_count(template.fragment_count, template.template_type)}. {warning} " ) diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index b3f1da6033..ab903ac59d 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -50,7 +50,7 @@
+ {{ notification.carrier}} +
+ {% if displayed_on_single_line %}{% endif %} + {% endcall %} + {% endif %} +{% endmacro %} + +{% macro notification_carrier_message_field(notification) %} + + {% if not notification %} + {% call field(align='right') %}{% endcall %} + {% else %} + + {% call field( + status=status, + align='right' + ) %} ++ {{notification.provider_response}} +
+ {% if displayed_on_single_line %}{% endif %} + {% endcall %} + {% endif %} +{% endmacro %} {% macro spark_bar_field( count, @@ -189,7 +225,7 @@ {% call field(align='right') %} - {{ '{:,.0f}'.format(count) }} + {{ '{:,.0f}'.format(count) }} -{% endblock %} \ No newline at end of file +{% endblock %} From 13d3ffd9143df7e1f1bb3cb12e88f00df143e863 Mon Sep 17 00:00:00 2001 From: Beverly NguyenNotify.gov is a text message service that helps federal, state, local, tribal and territorial goverments more effectively communicate with the people who use their services.
+Notify.gov is a text message service that helps federal, state, local, tribal and territorial governments more effectively communicate with the people who use their services.
Notify.gov is a text message service that helps federal, state, local, tribal and territorial governments more effectively communicate with the people who use their services.
+Notify.gov is a text message service that helps federal, state, local, tribal and territorial governments more effectively communicate with the people they serve.