2023-07-12 12:09:44 -04:00
|
|
|
from app.models.organization import Organization
|
2022-03-03 12:51:38 +00:00
|
|
|
|
2022-03-22 17:20:02 +00:00
|
|
|
NHS_EMAIL_BRANDING_ID = 'a7dc4e56-660b-4db7-8cff-12c37b12b5ea'
|
2022-03-22 17:01:54 +00:00
|
|
|
|
2022-03-03 12:51:38 +00:00
|
|
|
|
2022-03-22 16:56:50 +00:00
|
|
|
def get_email_choices(service):
|
2023-07-12 12:09:44 -04:00
|
|
|
organization_branding_id = service.organization.email_branding_id if service.organization else None
|
2022-03-03 12:51:38 +00:00
|
|
|
|
|
|
|
|
if (
|
2023-07-12 12:09:44 -04:00
|
|
|
service.organization_type == Organization.TYPE_FEDERAL
|
2022-03-22 17:29:39 +00:00
|
|
|
and service.email_branding_id is not None # GOV.UK is not current branding
|
2023-07-12 12:09:44 -04:00
|
|
|
and organization_branding_id is None # no default to supersede it (GOV.UK)
|
2022-03-03 12:51:38 +00:00
|
|
|
):
|
|
|
|
|
yield ('govuk', 'GOV.UK')
|
|
|
|
|
|
|
|
|
|
if (
|
2023-07-12 12:09:44 -04:00
|
|
|
service.organization_type == Organization.TYPE_FEDERAL
|
|
|
|
|
and service.organization
|
|
|
|
|
and organization_branding_id is None # don't offer both if org has default
|
|
|
|
|
and service.email_branding_name.lower() != f'GOV.UK and {service.organization.name}'.lower()
|
2022-03-03 12:51:38 +00:00
|
|
|
):
|
2023-07-12 12:09:44 -04:00
|
|
|
yield ('govuk_and_org', f'GOV.UK and {service.organization.name}')
|