Skip to content

Commit

Permalink
FIX content_item
Browse files Browse the repository at this point in the history
  • Loading branch information
KludgeKML committed Sep 5, 2024
1 parent 488301e commit 88fb1fe
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/models/content_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def initialize(content_store_response)
@title = content_store_response["title"]
@base_path = content_store_response["base_path"]
@locale = content_store_response["locale"]

content_store_response["links"]["ordered_related_items"] = ordered_related_items(content_store_response["links"]) if content_store_response["links"]
end

delegate :to_h, to: :content_store_response
Expand All @@ -20,4 +22,14 @@ def available_translations

translations.sort_by { |t| t["locale"] == I18n.default_locale.to_s ? "" : t["locale"] }
end

private

def ordered_related_items(links)
return [] if links["ordered_related_items_overrides"].present?

links["ordered_related_items"].presence || links.fetch(
"suggested_ordered_related_items", []
)
end
end

0 comments on commit 88fb1fe

Please sign in to comment.