Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove suggested_ordered_related_items #3005

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ def load_content_item
def ordered_related_items(links)
return [] if links["ordered_related_items_overrides"].present?

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

def format_banner_links(links, type)
Expand Down
10 changes: 0 additions & 10 deletions test/controllers/content_items_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,6 @@ class ContentItemsControllerTest < ActionController::TestCase
assert_nil content_item["links"]["ordered_related_items"]
end

test "gets item from content store and replaces ordered_related_items there are no existing links or overrides" do
content_item = content_store_has_schema_example("case_study", "case_study")

get :show, params: { path: path_for(content_item) }
assert_response :success
assert_empty content_item["links"]["ordered_related_items"], "Content item should not have existing related links"
assert_not_empty content_item["links"]["suggested_ordered_related_items"], "Content item should have existing suggested related links"
assert_equal assigns[:content_item].content_item["links"]["ordered_related_items"], content_item["links"]["suggested_ordered_related_items"]
end

test "sets the expiry as sent by content-store" do
content_item = content_store_has_schema_example("case_study", "case_study")
stub_content_store_has_item(content_item["base_path"], content_item, max_age: 20)
Expand Down