mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 15:15:38 -05:00
Look in email_branding for brand_type, not service
https://www.pivotaltracker.com/story/show/159986276 We are now setting the type of branding on the branding itself, not on the service. This commit switches over from looking in the old place (on the service) to looking in the new place (on the branding).
This commit is contained in:
@@ -23,7 +23,7 @@ from app.exceptions import NotificationTechnicalFailureException
|
||||
from app.models import (
|
||||
SMS_TYPE,
|
||||
KEY_TYPE_TEST,
|
||||
BRANDING_ORG,
|
||||
BRANDING_BOTH,
|
||||
BRANDING_ORG_BANNER,
|
||||
BRANDING_GOVUK,
|
||||
EMAIL_TYPE,
|
||||
@@ -189,24 +189,28 @@ def get_logo_url(base_url, logo_file):
|
||||
|
||||
|
||||
def get_html_email_options(service):
|
||||
govuk_banner = service.branding not in (BRANDING_ORG, BRANDING_ORG_BANNER)
|
||||
brand_banner = service.branding == BRANDING_ORG_BANNER
|
||||
if service.branding != BRANDING_GOVUK and service.email_branding:
|
||||
|
||||
logo_url = get_logo_url(
|
||||
current_app.config['ADMIN_BASE_URL'],
|
||||
service.email_branding.logo
|
||||
) if service.email_branding.logo else None
|
||||
|
||||
branding = {
|
||||
'brand_colour': service.email_branding.colour,
|
||||
'brand_logo': logo_url,
|
||||
'brand_name': service.email_branding.text,
|
||||
if (
|
||||
service.email_branding is None or
|
||||
service.email_branding.brand_type == BRANDING_GOVUK
|
||||
):
|
||||
return {
|
||||
'govuk_banner': True,
|
||||
'brand_banner': False,
|
||||
}
|
||||
else:
|
||||
branding = {}
|
||||
|
||||
return dict(govuk_banner=govuk_banner, brand_banner=brand_banner, **branding)
|
||||
logo_url = get_logo_url(
|
||||
current_app.config['ADMIN_BASE_URL'],
|
||||
service.email_branding.logo
|
||||
) if service.email_branding.logo else None
|
||||
|
||||
return {
|
||||
'govuk_banner': service.email_branding.brand_type == BRANDING_BOTH,
|
||||
'brand_banner': service.email_branding.brand_type == BRANDING_ORG_BANNER,
|
||||
'brand_colour': service.email_branding.colour,
|
||||
'brand_logo': logo_url,
|
||||
'brand_name': service.email_branding.text,
|
||||
}
|
||||
|
||||
|
||||
def technical_failure(notification):
|
||||
|
||||
Reference in New Issue
Block a user