mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
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:
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user