Skip to content

Commit a996d71

Browse files
committed
Make HTML publication page more robust
Since moving the organisation logo to the gem we're seeing intermittent test failures. This happens in cases where the random content generator in `HtmlPublicationTest` generates an organisation item without a logo in the details. This makes [`organisation_logo` return nil][1], which is passed into the component, which subsequently crashes with a nil-error. This makes the page more robust by only displaying logos that exist. [1]: https://github.com/alphagov/government-frontend/blob/fc0f75cd16f4e1f1266 90cf5f9aee005af504186/app/presenters/content_item/organisation_branding. rb#L4
1 parent fc0f75c commit a996d71

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/views/content_items/html_publication.html.erb

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
<div class="publication-external">
1313
<ol class="organisation-logos">
1414
<% @content_item.organisations.each do |organisation| %>
15+
<% logo_attributes = @content_item.organisation_logo(organisation) %>
16+
<% next unless logo_attributes %>
1517
<li class="organisation-logo">
16-
<%= render 'govuk_publishing_components/components/organisation_logo', @content_item.organisation_logo(organisation) %>
18+
<%= render 'govuk_publishing_components/components/organisation_logo', logo_attributes %>
1719
</li>
1820
<% end %>
1921
</ol>

0 commit comments

Comments
 (0)