mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
Added a method to decide which colour to send to the notifications-utils HTMLEmailTemplate to create the content.
This commit is contained in:
@@ -30,7 +30,8 @@ from app.models import (
|
||||
NOTIFICATION_CREATED,
|
||||
NOTIFICATION_TECHNICAL_FAILURE,
|
||||
NOTIFICATION_SENT,
|
||||
NOTIFICATION_SENDING
|
||||
NOTIFICATION_SENDING,
|
||||
BRANDING_BOTH
|
||||
)
|
||||
|
||||
|
||||
@@ -198,8 +199,10 @@ def get_html_email_options(service):
|
||||
service.email_branding.logo
|
||||
) if service.email_branding.logo else None
|
||||
|
||||
colour = _set_colour(service)
|
||||
|
||||
branding = {
|
||||
'brand_colour': service.email_branding.colour,
|
||||
'brand_colour': colour,
|
||||
'brand_logo': logo_url,
|
||||
'brand_name': service.email_branding.text,
|
||||
}
|
||||
@@ -209,6 +212,15 @@ def get_html_email_options(service):
|
||||
return dict(govuk_banner=govuk_banner, brand_banner=brand_banner, **branding)
|
||||
|
||||
|
||||
def _set_colour(service):
|
||||
if service.branding in [BRANDING_BOTH, BRANDING_ORG]:
|
||||
return service.email_branding.single_id_colour or service.email_branding.colour
|
||||
elif service.branding == BRANDING_ORG_BANNER:
|
||||
return service.email_branding.banner_colour or service.email_branding.colour
|
||||
elif service.branding == BRANDING_GOVUK:
|
||||
return None
|
||||
|
||||
|
||||
def technical_failure(notification):
|
||||
notification.status = NOTIFICATION_TECHNICAL_FAILURE
|
||||
dao_update_notification(notification)
|
||||
|
||||
Reference in New Issue
Block a user