Fix issue that happens with branding_style of None

Setting the branding_style to 'None' causes the
API to remove the email_branding field from a
service model. The branding request page
controller was depending on that value being
to present get the brand type.

The email preview page (used in an iframe on
various pages) wasn't able to recognise a
branding_style of 'None', causing a blank page to
render.
This commit is contained in:
Tom Byers
2018-08-30 11:38:47 +01:00
parent 1d3b5fda62
commit ad0ffcc3f3
2 changed files with 9 additions and 5 deletions

View File

@@ -81,9 +81,9 @@ def design_content():
@main.route('/_email')
def email_template():
branding_type = 'govuk'
branding_style = request.args.get('branding_style', None)
branding_style = request.args.get('branding_style', 'None')
if branding_style:
if branding_style != 'None':
email_branding = email_branding_client.get_email_branding(branding_style)['email_branding']
branding_type = email_branding['brand_type']

View File

@@ -971,11 +971,15 @@ def link_service_to_organisation(service_id):
@user_has_permissions('manage_service')
def branding_request(service_id):
email_branding = email_branding_client.get_email_branding(
current_service.email_branding)['email_branding']
branding_type = 'govuk'
if current_service.email_branding:
email_branding = email_branding_client.get_email_branding(
current_service.email_branding)['email_branding']
branding_type = email_branding['brand_type']
form = BrandingOptionsEmail(
options=email_branding['brand_type']
options=branding_type
)
if form.validate_on_submit():