mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
Merge pull request #1269 from alphagov/fix-sending-emails-no-logo
Fix sending emails with no logo
This commit is contained in:
@@ -179,10 +179,11 @@ def get_html_email_options(service):
|
|||||||
govuk_banner = service.branding not in (BRANDING_ORG, BRANDING_ORG_BANNER)
|
govuk_banner = service.branding not in (BRANDING_ORG, BRANDING_ORG_BANNER)
|
||||||
brand_banner = service.branding == BRANDING_ORG_BANNER
|
brand_banner = service.branding == BRANDING_ORG_BANNER
|
||||||
if service.organisation and service.branding != BRANDING_GOVUK:
|
if service.organisation and service.branding != BRANDING_GOVUK:
|
||||||
|
|
||||||
logo_url = get_logo_url(
|
logo_url = get_logo_url(
|
||||||
current_app.config['ADMIN_BASE_URL'],
|
current_app.config['ADMIN_BASE_URL'],
|
||||||
service.organisation.logo
|
service.organisation.logo
|
||||||
)
|
) if service.organisation.logo else None
|
||||||
|
|
||||||
branding = {
|
branding = {
|
||||||
'brand_colour': service.organisation.colour,
|
'brand_colour': service.organisation.colour,
|
||||||
|
|||||||
@@ -459,6 +459,18 @@ def test_get_html_email_renderer_prepends_logo_path(notify_api):
|
|||||||
assert renderer['brand_logo'] == 'http://static-logos.notify.tools/justice-league.png'
|
assert renderer['brand_logo'] == 'http://static-logos.notify.tools/justice-league.png'
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_html_email_renderer_handles_org_without_logo(notify_api):
|
||||||
|
Service = namedtuple('Service', ['branding', 'organisation'])
|
||||||
|
Organisation = namedtuple('Organisation', ['colour', 'name', 'logo'])
|
||||||
|
|
||||||
|
org = Organisation(colour='#000000', logo=None, name='Justice League')
|
||||||
|
service = Service(branding=BRANDING_ORG, organisation=org)
|
||||||
|
|
||||||
|
renderer = send_to_providers.get_html_email_options(service)
|
||||||
|
|
||||||
|
assert renderer['brand_logo'] is None
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('base_url, expected_url', [
|
@pytest.mark.parametrize('base_url, expected_url', [
|
||||||
# don't change localhost to prevent errors when testing locally
|
# don't change localhost to prevent errors when testing locally
|
||||||
('http://localhost:6012', 'http://static-logos.notify.tools/filename.png'),
|
('http://localhost:6012', 'http://static-logos.notify.tools/filename.png'),
|
||||||
|
|||||||
Reference in New Issue
Block a user