Assign email branding based on user’s email domain

When a user creates a service we can take a pretty good guess at what
organisation they’re from.

For many organisations, especially local councils, GOV.UK branding is
not appropriate for their service. But right now every service:
- gets created with GOV.UK branding
- has to ask us to change it, even if they’ve already done so for other
  services they run

This commit starts using the `domain` field on the email branding table
to lookup what email branding to assign to a service automatically,
where we’re sure there’s a sensible default.
This commit is contained in:
Chris Hill-Scott
2018-09-03 11:46:41 +01:00
parent 2e7ae91029
commit 243fdb0260
4 changed files with 57 additions and 4 deletions

View File

@@ -17,6 +17,12 @@ class EmailBrandingClient(NotifyAdminAPIClient):
brandings.sort(key=lambda branding: branding[sort_key].lower())
return brandings
def get_email_branding_id_for_domain(self, domain):
for branding in self.get_all_email_branding():
if domain and branding.get('domain') == domain:
return branding['id']
return None
def get_letter_email_branding(self):
return self.get(url='/dvla_organisations')