Skip to content

Commit

Permalink
Merge pull request #3182 from alphagov/revert-embed-optimisation
Browse files Browse the repository at this point in the history
Revert "Do not loop through details unless embed links exist"
  • Loading branch information
mike3985 authored Mar 7, 2025
2 parents 0605762 + 0c784c2 commit 6855ad5
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions app/presenters/content_embed_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ def initialize(edition)
end

def render_embedded_content(details)
return details unless target_content_ids

details.each_pair do |field, value|
next if value.blank?

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

private

def target_content_ids
@target_content_ids ||= @edition
.links
.where(link_type: "embed")
.pluck(:target_content_id)
end

def embedded_editions
@embedded_editions ||= begin
target_content_ids = @edition
.links
.where(link_type: "embed")
.pluck(:target_content_id)

embedded_edition_ids = ::Queries::GetEditionIdsWithFallbacks.call(
target_content_ids,
locale_fallback_order: [@edition.locale, Edition::DEFAULT_LOCALE].uniq,
Expand Down

0 comments on commit 6855ad5

Please sign in to comment.