From 602f2fccfd8f5028788b26fb05e36f3ad05ba870 Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Tue, 27 Feb 2024 16:38:58 -0500 Subject: [PATCH] 1219 - Deleting references to the "Terms" page I kept the actual HTML in case we want/need to add it back in the future. Can reference this branch to do so. --- app/main/forms.py | 16 +++++++---- app/main/views/api_keys.py | 22 +++++++++------ app/main/views/index.py | 11 -------- app/main/views/manage_users.py | 22 ++++++++------- app/main/views/performance.py | 6 ++-- app/main/views/send.py | 28 +++++++++++-------- app/main/views/service_settings.py | 24 ++++++++++------ app/main/views/sub_navigation_dictionaries.py | 4 --- app/navigation.py | 1 - app/templates/admin_template.html | 4 --- tests/app/main/views/test_index.py | 14 ++++------ tests/app/test_navigation.py | 2 -- 12 files changed, 75 insertions(+), 79 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index c01ce8fcce..2e6655cc5f 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -1781,12 +1781,16 @@ def __init__( None, [ # ('email', 'Email') if 'email' in available_template_types else None, - ("sms", "Start with a blank template") - if "sms" in available_template_types - else None, - ("copy-existing", "Copy an existing template") - if allow_adding_copy_of_template - else None, + ( + ("sms", "Start with a blank template") + if "sms" in available_template_types + else None + ), + ( + ("copy-existing", "Copy an existing template") + if allow_adding_copy_of_template + else None + ), ], ) ) diff --git a/app/main/views/api_keys.py b/app/main/views/api_keys.py index 4f8c3b29ef..8cb28ba591 100644 --- a/app/main/views/api_keys.py +++ b/app/main/views/api_keys.py @@ -168,12 +168,14 @@ def api_callbacks(service_id): return render_template( "views/api/callbacks.html", - received_text_messages_callback=received_text_messages_callback["url"] - if received_text_messages_callback - else None, - delivery_status_callback=delivery_status_callback["url"] - if delivery_status_callback - else None, + received_text_messages_callback=( + received_text_messages_callback["url"] + if received_text_messages_callback + else None + ), + delivery_status_callback=( + delivery_status_callback["url"] if delivery_status_callback else None + ), ) @@ -262,9 +264,11 @@ def received_text_messages_callback(service_id): received_text_messages_callback = get_received_text_messages_callback() form = CallbackForm( - url=received_text_messages_callback.get("url") - if received_text_messages_callback - else "", + url=( + received_text_messages_callback.get("url") + if received_text_messages_callback + else "" + ), bearer_token=dummy_bearer_token if received_text_messages_callback else "", ) diff --git a/app/main/views/index.py b/app/main/views/index.py index f4e3a67dbf..e6107ab106 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -102,15 +102,6 @@ def security(): return render_template("views/security.html", navigation_links=features_nav()) -@main.route("/features/terms", endpoint="terms") -@user_is_logged_in -def terms(): - return render_template( - "views/terms-of-use.html", - navigation_links=features_nav(), - ) - - @main.route("/features/using_notify") @user_is_logged_in def using_notify(): @@ -214,7 +205,6 @@ def send_files_by_email(): @main.route("/roadmap", endpoint="old_roadmap") -@main.route("/terms", endpoint="old_terms") @main.route("/information-security", endpoint="information_security") @main.route("/using_notify", endpoint="old_using_notify") @main.route("/information-risk-management", endpoint="information_risk_management") @@ -222,7 +212,6 @@ def send_files_by_email(): def old_page_redirects(): redirects = { "main.old_roadmap": "main.roadmap", - "main.old_terms": "main.terms", "main.information_security": "main.using_notify", "main.old_using_notify": "main.using_notify", "main.information_risk_management": "main.security", diff --git a/app/main/views/manage_users.py b/app/main/views/manage_users.py index 4ab20f363d..1b80c659e2 100644 --- a/app/main/views/manage_users.py +++ b/app/main/views/manage_users.py @@ -122,16 +122,18 @@ def edit_user_permissions(service_id, user_id): form = form_class.from_user( user, service_id, - folder_permissions=None - if user.platform_admin - else [ - f["id"] - for f in current_service.all_template_folders - if user.has_template_folder_permission(f) - ], - all_template_folders=None - if user.platform_admin - else current_service.all_template_folders, + folder_permissions=( + None + if user.platform_admin + else [ + f["id"] + for f in current_service.all_template_folders + if user.has_template_folder_permission(f) + ] + ), + all_template_folders=( + None if user.platform_admin else current_service.all_template_folders + ), ) if form.validate_on_submit(): diff --git a/app/main/views/performance.py b/app/main/views/performance.py index 13445967b6..1d2a4d1bcf 100644 --- a/app/main/views/performance.py +++ b/app/main/views/performance.py @@ -34,8 +34,8 @@ def performance(): stats["average_percentage_under_10_seconds"] = mean( [row["percentage_under_10_seconds"] for row in stats["processing_time"]] or [0] ) - stats[ - "count_of_live_services_and_organizations" - ] = status_api_client.get_count_of_live_services_and_organizations() + stats["count_of_live_services_and_organizations"] = ( + status_api_client.get_count_of_live_services_and_organizations() + ) return render_template("views/performance.html", **stats) diff --git a/app/main/views/send.py b/app/main/views/send.py index 4332c7ddbe..6c786e3acb 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -52,12 +52,14 @@ def get_example_csv_fields(column_headers, use_example_as_example, submitted_fie def get_example_csv_rows(template, use_example_as_example=True, submitted_fields=False): return { - "email": ["test@example.com"] - if use_example_as_example - else [current_user.email_address], - "sms": ["12223334444"] - if use_example_as_example - else [current_user.mobile_number], + "email": ( + ["test@example.com"] + if use_example_as_example + else [current_user.email_address] + ), + "sms": ( + ["12223334444"] if use_example_as_example else [current_user.mobile_number] + ), }[template.template_type] + get_example_csv_fields( ( placeholder @@ -511,12 +513,14 @@ def _check_messages(service_id, template_id, upload_id, preview_row): template=template, max_initial_rows_shown=50, max_errors_shown=50, - guestlist=itertools.chain.from_iterable( - [user.name, user.mobile_number, user.email_address] - for user in Users(service_id) - ) - if current_service.trial_mode - else None, + guestlist=( + itertools.chain.from_iterable( + [user.name, user.mobile_number, user.email_address] + for user in Users(service_id) + ) + if current_service.trial_mode + else None + ), remaining_messages=remaining_messages, allow_international_sms=current_service.has_permission("international_sms"), ) diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index 1cac1410c8..628ac59e58 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -477,9 +477,11 @@ def service_edit_email_reply_to(service_id, reply_to_email_id): current_service.id, reply_to_email_id=reply_to_email_id, email_address=form.email_address.data, - is_default=True - if reply_to_email_address["is_default"] - else form.is_default.data, + is_default=( + True + if reply_to_email_address["is_default"] + else form.is_default.data + ), ) return redirect(url_for(".service_email_reply_to", service_id=service_id)) try: @@ -499,9 +501,11 @@ def service_edit_email_reply_to(service_id, reply_to_email_id): ".service_verify_reply_to_address", service_id=service_id, notification_id=notification_id, - is_default=True - if reply_to_email_address["is_default"] - else form.is_default.data, + is_default=( + True + if reply_to_email_address["is_default"] + else form.is_default.data + ), replace=reply_to_email_id, ) ) @@ -702,9 +706,11 @@ def service_edit_sms_sender(service_id, sms_sender_id): service_api_client.update_sms_sender( current_service.id, sms_sender_id=sms_sender_id, - sms_sender=sms_sender["sms_sender"] - if is_inbound_number - else form.sms_sender.data.replace("\r", ""), + sms_sender=( + sms_sender["sms_sender"] + if is_inbound_number + else form.sms_sender.data.replace("\r", "") + ), is_default=True if sms_sender["is_default"] else form.is_default.data, ) return redirect(url_for(".service_sms_senders", service_id=service_id)) diff --git a/app/main/views/sub_navigation_dictionaries.py b/app/main/views/sub_navigation_dictionaries.py index f76d69c14f..5e32bc003b 100644 --- a/app/main/views/sub_navigation_dictionaries.py +++ b/app/main/views/sub_navigation_dictionaries.py @@ -18,10 +18,6 @@ def features_nav(): "name": "Security", "link": "main.security", }, - { - "name": "Terms of use", - "link": "main.terms", - }, ] diff --git a/app/navigation.py b/app/navigation.py index 94f970540d..3c79598cc7 100644 --- a/app/navigation.py +++ b/app/navigation.py @@ -45,7 +45,6 @@ class HeaderNavigation(Navigation): "features_sms", "roadmap", "security", - "terms", }, "using_notify": { "get_started", diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index c48f768ceb..6b33fed058 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -201,10 +201,6 @@ "href": url_for("main.security"), "text": "Security" }, - { - "href": url_for("main.terms"), - "text": "Terms of use" - }, ] }, { diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py index 315ef635a8..986bfc34e9 100644 --- a/tests/app/main/views/test_index.py +++ b/tests/app/main/views/test_index.py @@ -90,7 +90,6 @@ def test_hiding_pages_from_search_engines( [ "privacy", "pricing", - "terms", "roadmap", "features", "documentation", @@ -167,7 +166,6 @@ def test_guidance_pages_link_to_service_pages_when_signed_in( ("information_risk_management", "security"), ("old_integration_testing", "integration_testing"), ("old_roadmap", "roadmap"), - ("old_terms", "terms"), ("information_security", "using_notify"), ("old_using_notify", "using_notify"), ("delivery_and_failure", "message_status"), @@ -226,12 +224,12 @@ def test_old_using_notify_page(client_request): # ) -def test_terms_page_has_correct_content(client_request): - terms_page = client_request.get("main.terms") - assert normalize_spaces(terms_page.select("main p")[0].text) == ( - "These terms apply to your service’s use of Notify.gov. " - "You must be the service manager to accept them." - ) +# def test_terms_page_has_correct_content(client_request): +# terms_page = client_request.get("main.terms") +# assert normalize_spaces(terms_page.select("main p")[0].text) == ( +# "These terms apply to your service’s use of Notify.gov. " +# "You must be the service manager to accept them." +# ) def test_css_is_served_from_correct_path(client_request): diff --git a/tests/app/test_navigation.py b/tests/app/test_navigation.py index 110bae914a..1f1da29154 100644 --- a/tests/app/test_navigation.py +++ b/tests/app/test_navigation.py @@ -128,7 +128,6 @@ "old_integration_testing", "old_roadmap", "old_service_dashboard", - "old_terms", "old_using_notify", "organization_billing", "organization_dashboard", @@ -205,7 +204,6 @@ "suspend_service", "template_history", "template_usage", - "terms", "tour_step", "trial_mode", "trial_mode_new",