Skip to content

Commit 6855ad5

Browse files
authored
Merge pull request #3182 from alphagov/revert-embed-optimisation
Revert "Do not loop through details unless embed links exist"
2 parents 0605762 + 0c784c2 commit 6855ad5

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

app/presenters/content_embed_presenter.rb

+5-9
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ def initialize(edition)
55
end
66

77
def render_embedded_content(details)
8-
return details unless target_content_ids
9-
108
details.each_pair do |field, value|
119
next if value.blank?
1210

@@ -18,15 +16,13 @@ def render_embedded_content(details)
1816

1917
private
2018

21-
def target_content_ids
22-
@target_content_ids ||= @edition
23-
.links
24-
.where(link_type: "embed")
25-
.pluck(:target_content_id)
26-
end
27-
2819
def embedded_editions
2920
@embedded_editions ||= begin
21+
target_content_ids = @edition
22+
.links
23+
.where(link_type: "embed")
24+
.pluck(:target_content_id)
25+
3026
embedded_edition_ids = ::Queries::GetEditionIdsWithFallbacks.call(
3127
target_content_ids,
3228
locale_fallback_order: [@edition.locale, Edition::DEFAULT_LOCALE].uniq,

0 commit comments

Comments
 (0)