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:
Chris Hill-Scott
2018-08-28 14:25:16 +01:00
parent a21972d7b6
commit 2671ca3e5e
2 changed files with 67 additions and 31 deletions

View File

@@ -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):