From 65ea2484293ea07c8522372f6737a4084fd7b5b0 Mon Sep 17 00:00:00 2001
From: Kenneth Kehl <@kkehl@flexion.us>
Date: Thu, 13 Apr 2023 07:13:04 -0700
Subject: [PATCH] #446 remove crown
---
app/assets/error_pages/5xx.html | 9 +--
app/main/forms.py | 17 +-----
app/main/views/agreement.py | 9 +--
app/main/views/organisations.py | 32 +----------
app/models/organisation.py | 17 +-----
app/navigation.py | 1 -
app/notify_client/organisations_api_client.py | 3 +-
app/s3_client/s3_mou_client.py | 9 ++-
.../uk_components/header/_header.scss | 13 +----
.../uk_components/header/template.njk | 2 +-
.../support-tickets/go-live-request.txt | 2 +-
.../agreement/service-agreement-choose.html | 41 -------------
.../views/organisations/add-organisation.html | 1 -
.../settings/edit-crown-status.html | 25 --------
.../organisation/settings/index.html | 16 ------
tests/__init__.py | 2 -
.../views/organisations/test_organisations.py | 57 ++++---------------
.../service_settings/test_service_settings.py | 6 +-
tests/app/main/views/test_agreement.py | 45 +++++----------
tests/app/main/views/test_index.py | 4 +-
tests/app/models/test_user.py | 1 -
tests/app/test_assets.py | 10 ----
tests/app/test_navigation.py | 1 -
23 files changed, 47 insertions(+), 276 deletions(-)
delete mode 100644 app/templates/views/agreement/service-agreement-choose.html
delete mode 100644 app/templates/views/organisations/organisation/settings/edit-crown-status.html
diff --git a/app/assets/error_pages/5xx.html b/app/assets/error_pages/5xx.html
index 4787a9393..13adac296 100644
--- a/app/assets/error_pages/5xx.html
+++ b/app/assets/error_pages/5xx.html
@@ -41,14 +41,14 @@
, except where otherwise stated
-
diff --git a/app/main/forms.py b/app/main/forms.py
index cb2d72f45..fed38965b 100644
--- a/app/main/forms.py
+++ b/app/main/forms.py
@@ -1145,18 +1145,6 @@ class OrganisationOrganisationTypeForm(StripWhitespaceForm):
organisation_type = OrganisationTypeField('What type of organization is this?')
-class OrganisationCrownStatusForm(StripWhitespaceForm):
- crown_status = GovukRadiosField(
- 'Is this organization a crown body?',
- choices=[
- ('crown', 'Yes'),
- ('non-crown', 'No'),
- ('unknown', 'Not sure'),
- ],
- thing='whether this organization is a crown body',
- )
-
-
class OrganisationAgreementSignedForm(StripWhitespaceForm):
agreement_signed = GovukRadiosField(
'Has this organization signed the agreement?',
@@ -1209,13 +1197,10 @@ class CreateServiceForm(StripWhitespaceForm):
class AdminNewOrganisationForm(
RenameOrganisationForm,
- OrganisationOrganisationTypeForm,
- OrganisationCrownStatusForm,
+ OrganisationOrganisationTypeForm
):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
- # Don’t offer the ‘not sure’ choice
- self.crown_status.choices = self.crown_status.choices[:-1]
class AdminServiceSMSAllowanceForm(StripWhitespaceForm):
diff --git a/app/main/views/agreement.py b/app/main/views/agreement.py
index 930185924..3dd878526 100644
--- a/app/main/views/agreement.py
+++ b/app/main/views/agreement.py
@@ -23,8 +23,6 @@ def service_agreement(service_id):
return redirect(
url_for('main.add_organisation_from_nhs_local_service', service_id=current_service.id)
)
- if current_service.organisation.crown is None:
- return render_template('views/agreement/service-agreement-choose.html')
if current_service.organisation.agreement_signed:
return render_template('views/agreement/service-agreement-signed.html')
return render_template('views/agreement/service-agreement.html')
@@ -34,7 +32,6 @@ def service_agreement(service_id):
@user_has_permissions('manage_service')
def service_download_agreement(service_id):
return send_file(**get_mou(
- current_service.organisation.crown_status_or_404
))
@@ -85,13 +82,13 @@ def service_confirm_agreement(service_id):
@main.route('/agreement/', endpoint='public_agreement')
@main.route('/agreement/.pdf', endpoint='public_download_agreement')
def public_agreement(variant):
-
- if variant not in {'crown', 'non-crown'}:
+ # originally we returned 404 if variant was not in ['crown', 'not_crown']. Will we be using agreement.pdf?
+ # for now this is just to keep tests working as expected.
+ if variant != "agreement":
abort(404)
if request.endpoint == 'main.public_download_agreement':
return send_file(**get_mou(
- organisation_is_crown=(variant == 'crown')
))
return render_template(
diff --git a/app/main/views/organisations.py b/app/main/views/organisations.py
index 82d98fc05..12eb7de98 100644
--- a/app/main/views/organisations.py
+++ b/app/main/views/organisations.py
@@ -23,7 +23,6 @@ from app.main.forms import (
AdminSetEmailBrandingForm,
InviteOrgUserForm,
OrganisationAgreementSignedForm,
- OrganisationCrownStatusForm,
OrganisationOrganisationTypeForm,
RenameOrganisationForm,
SearchByNameForm,
@@ -278,35 +277,6 @@ def edit_organisation_type(org_id):
)
-@main.route("/organisations//settings/edit-crown-status", methods=['GET', 'POST'])
-@user_is_platform_admin
-def edit_organisation_crown_status(org_id):
-
- form = OrganisationCrownStatusForm(
- crown_status={
- True: 'crown',
- False: 'non-crown',
- None: 'unknown',
- }.get(current_organisation.crown)
- )
-
- if form.validate_on_submit():
- organisations_client.update_organisation(
- current_organisation.id,
- crown={
- 'crown': True,
- 'non-crown': False,
- 'unknown': None,
- }.get(form.crown_status.data),
- )
- return redirect(url_for('.organisation_settings', org_id=org_id))
-
- return render_template(
- 'views/organisations/organisation/settings/edit-crown-status.html',
- form=form,
- )
-
-
@main.route("/organisations//settings/edit-agreement", methods=['GET', 'POST'])
@user_is_platform_admin
def edit_organisation_agreement(org_id):
@@ -500,5 +470,5 @@ def organisation_billing(org_id):
@user_is_platform_admin
def organisation_download_agreement(org_id):
return send_file(**get_mou(
- current_organisation.crown_status_or_404
+
))
diff --git a/app/models/organisation.py b/app/models/organisation.py
index 0492c6897..282c1a851 100644
--- a/app/models/organisation.py
+++ b/app/models/organisation.py
@@ -1,6 +1,5 @@
from collections import OrderedDict
-from flask import abort
from werkzeug.utils import cached_property
from app.models import (
@@ -29,7 +28,6 @@ class Organisation(JSONModel, SortByNameMixin):
'id',
'name',
'active',
- 'crown',
'organisation_type',
'email_branding_id',
'agreement_signed',
@@ -66,19 +64,13 @@ class Organisation(JSONModel, SortByNameMixin):
def create_from_form(cls, form):
return cls.create(
name=form.name.data,
- crown={
- 'crown': True,
- 'non-crown': False,
- 'unknown': None,
- }.get(form.crown_status.data),
organisation_type=form.organisation_type.data,
)
@classmethod
- def create(cls, name, crown, organisation_type, agreement_signed=False):
+ def create(cls, name, organisation_type, agreement_signed=False):
return cls(organisations_client.create_organisation(
name=name,
- crown=crown,
organisation_type=organisation_type,
agreement_signed=agreement_signed,
))
@@ -89,7 +81,6 @@ class Organisation(JSONModel, SortByNameMixin):
if self._dict == {}:
self.name = None
- self.crown = None
self.agreement_signed = None
self.domains = []
self.organisation_type = None
@@ -100,12 +91,6 @@ class Organisation(JSONModel, SortByNameMixin):
def organisation_type_label(self):
return self.TYPE_LABELS.get(self.organisation_type)
- @property
- def crown_status_or_404(self):
- if self.crown is None:
- abort(404)
- return self.crown
-
@property
def billing_details(self):
billing_details = [
diff --git a/app/navigation.py b/app/navigation.py
index 65c97deb3..44b6395d2 100644
--- a/app/navigation.py
+++ b/app/navigation.py
@@ -276,7 +276,6 @@ class OrgNavigation(Navigation):
'settings': {
'edit_organisation_agreement',
'edit_organisation_billing_details',
- 'edit_organisation_crown_status',
'edit_organisation_domains',
'edit_organisation_email_branding',
'edit_organisation_domains',
diff --git a/app/notify_client/organisations_api_client.py b/app/notify_client/organisations_api_client.py
index c073ba9b2..85128dc28 100644
--- a/app/notify_client/organisations_api_client.py
+++ b/app/notify_client/organisations_api_client.py
@@ -37,12 +37,11 @@ class OrganisationsClient(NotifyAdminAPIClient):
raise error
@cache.delete('organisations')
- def create_organisation(self, name, crown, organisation_type, agreement_signed):
+ def create_organisation(self, name, organisation_type, agreement_signed):
return self.post(
url="/organisations",
data={
"name": name,
- "crown": crown,
"organisation_type": organisation_type,
"agreement_signed": agreement_signed,
}
diff --git a/app/s3_client/s3_mou_client.py b/app/s3_client/s3_mou_client.py
index b18c5c968..1aeec1cdf 100644
--- a/app/s3_client/s3_mou_client.py
+++ b/app/s3_client/s3_mou_client.py
@@ -4,17 +4,16 @@ from flask import current_app
from app.s3_client.s3_logo_client import get_s3_object
-def get_mou(organisation_is_crown):
+def get_mou():
bucket = current_app.config['MOU_BUCKET_NAME']
- filename = 'crown.pdf' if organisation_is_crown else 'non-crown.pdf'
- attachment_filename = 'U.S. Notify data sharing and financial agreement{}.pdf'.format(
- '' if organisation_is_crown else ' (non-crown)'
+ filename = 'agreement.pdf'
+ attachment_filename = 'U.S. Notify data sharing and financial agreement.pdf'.format(
)
try:
key = get_s3_object(bucket, filename)
return {
'path_or_file': key.get()['Body'],
- 'attachment_filename': attachment_filename,
+ 'download_name': attachment_filename,
'as_attachment': True,
}
except botocore.exceptions.ClientError as exception:
diff --git a/app/templates/components/uk_components/header/_header.scss b/app/templates/components/uk_components/header/_header.scss
index ed1cbbb86..23f769997 100644
--- a/app/templates/components/uk_components/header/_header.scss
+++ b/app/templates/components/uk_components/header/_header.scss
@@ -45,13 +45,7 @@
margin-right: govuk-spacing(1);
}
- .govuk-header__logotype-crown {
- margin-right: 1px;
- fill: currentColor;
- vertical-align: middle;
- }
-
- .govuk-header__logotype-crown-fallback-image {
+ .govuk-header__logotype-fallback-image {
width: 36px;
height: 32px;
border: 0;
@@ -269,8 +263,7 @@
background: transparent;
}
- // Hide the inverted crown when printing in browsers that don't support SVG.
- .govuk-header__logotype-crown-fallback-image {
+ .govuk-header__logotype-fallback-image {
display: none;
}
@@ -289,7 +282,7 @@
// Begin adjustments for font baseline offset
// These should be removed when the font is updated with the correct baseline
- .govuk-header__logotype-crown {
+ .govuk-header__logotype {
position: relative;
top: -4px;
}
diff --git a/app/templates/components/uk_components/header/template.njk b/app/templates/components/uk_components/header/template.njk
index 1cd625c83..c4097c5b0 100644
--- a/app/templates/components/uk_components/header/template.njk
+++ b/app/templates/components/uk_components/header/template.njk
@@ -5,7 +5,7 @@