mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-05 14:11:41 -04:00
Add human-readable form of a government domain
This makes it easier to write a good message in the request to go live submission. And encapsulating it in the `GovernmentDomain` class keeps the view nice and clean.
This commit is contained in:
@@ -53,6 +53,8 @@ innovateuk.gov.uk:
|
||||
ncsc.gov.uk:
|
||||
owner: National Cyber Security Center
|
||||
agreement_signed: true
|
||||
nhs.net:
|
||||
owner: NHS
|
||||
nhsdigital.nhs.uk: digital.nhs.uk
|
||||
digital.nhs.uk:
|
||||
owner: NHS Digital
|
||||
|
||||
@@ -172,7 +172,6 @@ def request_to_go_live(service_id):
|
||||
@user_has_permissions('manage_service')
|
||||
def submit_request_to_go_live(service_id):
|
||||
form = RequestToGoLiveForm()
|
||||
agreement_info = GovernmentDomain.from_current_user()
|
||||
|
||||
if form.validate_on_submit():
|
||||
try:
|
||||
@@ -182,7 +181,7 @@ def submit_request_to_go_live(service_id):
|
||||
'On behalf of {} ({})\n'
|
||||
'\n---'
|
||||
'\nOrganisation type: {}'
|
||||
'\nAgreement signed: {} ({})'
|
||||
'\nAgreement signed: {}'
|
||||
'\nMOU in place: {}'
|
||||
'\nChannel: {}\nStart date: {}\nStart volume: {}'
|
||||
'\nPeak volume: {}'
|
||||
@@ -191,7 +190,7 @@ def submit_request_to_go_live(service_id):
|
||||
current_service['name'],
|
||||
url_for('main.service_dashboard', service_id=current_service['id'], _external=True),
|
||||
current_service['organisation_type'],
|
||||
agreement_info.agreement_signed, agreement_info.owner,
|
||||
GovernmentDomain.from_current_user().as_human_readable,
|
||||
form.mou.data,
|
||||
formatted_list(filter(None, (
|
||||
'email' if form.channel_email.data else None,
|
||||
|
||||
20
app/utils.py
20
app/utils.py
@@ -470,6 +470,26 @@ class GovernmentDomain:
|
||||
def from_current_user(cls):
|
||||
return cls.from_user(current_user)
|
||||
|
||||
@property
|
||||
def as_human_readable(self):
|
||||
if self.agreement_signed:
|
||||
return 'Yes, on behalf of {}'.format(self.owner)
|
||||
elif self.owner:
|
||||
return '{} (organisation is {}, {})'.format(
|
||||
{
|
||||
False: 'No',
|
||||
None: 'Can’t tell',
|
||||
}.get(self.agreement_signed),
|
||||
self.owner,
|
||||
{
|
||||
True: 'a crown body',
|
||||
False: 'a non-crown body',
|
||||
None: 'crown status unknown',
|
||||
}.get(self.crown_status),
|
||||
)
|
||||
else:
|
||||
return 'Can’t tell'
|
||||
|
||||
@staticmethod
|
||||
def get_matching_function(email_address_or_domain):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user