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

Add multi-level link expansion for edition links #2605

Closed
wants to merge 1 commit into from

Conversation

brucebolt
Copy link
Member

@brucebolt brucebolt commented Jan 18, 2024

Trello card

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

This application is owned by the publishing platform team. Please let us know in #govuk-publishing-platform when you raise any PRs.

Follow these steps if you are doing a Rails upgrade.

@brucebolt brucebolt force-pushed the implement-edition-link-expansion branch from a947c20 to 513a0db Compare January 18, 2024 10:21
@brucebolt brucebolt changed the title WIP: add multi-level link expansion for edition links Add multi-level link expansion for edition links Jan 18, 2024
@brucebolt brucebolt force-pushed the implement-edition-link-expansion branch from 513a0db to f42a62a Compare January 18, 2024 16:26
puts "from"
Link
.left_joins(edition: :document)
.left_joins(:link_set)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to join link_set here. If you look at the way this works in root_links_by_link_type, the idea is to make separate queries - one for link set links, and one for edition links.

  def root_links_by_link_type(content_id:, locale:, with_drafts: false)
    direct = own_links(content_id)
    reverse = linked_to(content_id, rules.reverse_links)
    edition = edition_links(content_id, locale, with_drafts)

    reverse.merge(direct).merge(edition)
  end

I assume we'd want to take a similar approach in child_links_by_link_type.

@brucebolt
Copy link
Member Author

Closing as there's no active work ongoing with this. Can always reopen, if we decide to continue with this.

@brucebolt brucebolt closed this Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants