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

Use edition links for Worldwide Organisations #3055

Merged
merged 2 commits into from
Jan 30, 2024
Merged

Conversation

brucebolt
Copy link
Member

@brucebolt brucebolt commented Jan 22, 2024

In alphagov/whitehall#8734 and alphagov/publishing-api#2601, we have switched worldwide organisations to use edition links to fix a bug in editionable worldwide organisations.

This applies the changes needed to the frontend to reflect the lack of multi-level link expansion in edition links.

Whilst this change adds support for edition links, it also retains compatibility with non-edition links. This will allow us to deploy the frontend changes in advance of republishing the content items, preventing any downtime of these pages. The code for backward compatibility will be removed once the content items have all been republished with edition links (all the code to be removed has been marked with a comment so it is easy to identify).

Trello card

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

Follow these steps if you are doing a Rails upgrade.

@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3055 January 22, 2024 13:53 Inactive
@brucebolt brucebolt force-pushed the add-wworg-edition-links branch from 8f692f4 to 66565e1 Compare January 22, 2024 14:55
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3055 January 22, 2024 14:56 Inactive
@brucebolt brucebolt marked this pull request as ready for review January 22, 2024 15:57
@brucebolt brucebolt force-pushed the add-wworg-edition-links branch from 66565e1 to 494dc83 Compare January 22, 2024 16:32
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3055 January 22, 2024 16:32 Inactive
brucebolt added a commit that referenced this pull request Jan 22, 2024
In #3055, we added
support for edition links associated with worldwide organisations. This
change included backward compatibility for worldwide organisations
without edition links.

Once the worldwide organisations have all been republished without
non-edition links, we no longer need the backward compatibility here.

This also simplifies the code slightly, as the content item now only
contains roles that are relevant to the worldwide organisation, rather
than needing to filter them on the frontend.
We are switching worldwide organisations to use edition links which do
not support multi-level link expanstion.

Therefore we need to switch the rendering code to use the new link
fields that have been added, in the absence of multi-level links.

This change adds support for edition links, but also retains
compatibility with non-edition links. This will allow us to deploy the
frontend changes in advance of republishing the content items,
preventing any downtime of these pages. The code for backward
compatibility will be removed once the content items have all been
republished with edition links.
We are switching worldwide organisations to use edition links which do
not support multi-level link expanstion.

Therefore we need to switch the rendering code to use the new link
fields that have been added, in the absence of multi-level links.

This change adds support for edition links, but also retains
compatibility with non-edition links. This will allow us to deploy the
frontend changes in advance of republishing the content items,
preventing any downtime of these pages. The code for backward
compatibility will be removed once the content items have all been
republished with edition links.
@brucebolt brucebolt force-pushed the add-wworg-edition-links branch from 494dc83 to ef6aa6a Compare January 22, 2024 16:40
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3055 January 22, 2024 16:40 Inactive
brucebolt added a commit that referenced this pull request Jan 22, 2024
In #3055, we added
support for edition links associated with worldwide organisations. This
change included backward compatibility for worldwide organisations
without edition links.

Once the worldwide organisations have all been republished without
non-edition links, we no longer need the backward compatibility here.

This also simplifies the code slightly, as the content item now only
contains roles that are relevant to the worldwide organisation, rather
than needing to filter them on the frontend.
brucebolt added a commit that referenced this pull request Jan 22, 2024
In #3055, we added
support for edition links associated with worldwide organisations. This
change included backward compatibility for worldwide organisations
without edition links.

Once the worldwide organisations have all been republished without
non-edition links, we no longer need the backward compatibility here.

This also simplifies the code slightly, as the content item now only
contains roles that are relevant to the worldwide organisation, rather
than needing to filter them on the frontend.
brucebolt added a commit that referenced this pull request Jan 22, 2024
In #3055, we added
support for edition links associated with worldwide organisations. This
change included backward compatibility for worldwide organisations
without edition links.

Once the worldwide organisations have all been republished without
non-edition links, we no longer need the backward compatibility here.

This also simplifies the code slightly, as the content item now only
contains roles that are relevant to the worldwide organisation, rather
than needing to filter them on the frontend.
brucebolt added a commit that referenced this pull request Jan 22, 2024
In #3055, we added
support for edition links associated with worldwide organisations. This
change included backward compatibility for worldwide organisations
without edition links.

Once the worldwide organisations have all been republished without
non-edition links, we no longer need the backward compatibility here.

This also simplifies the code slightly, as the content item now only
contains roles that are relevant to the worldwide organisation, rather
than needing to filter them on the frontend.
office_contact_association["office_content_id"] == office_content_id
}.first

return unless contact_mapping
Copy link
Contributor

Choose a reason for hiding this comment

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

I notice that we don't perform this check in roles_for_person. Could you possibly link me to the schema change in your publishing API PR that determines this difference?

Copy link
Member Author

@brucebolt brucebolt Jan 30, 2024

Choose a reason for hiding this comment

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

It's possible to have an office without a contact, whereas all the people will have a role (as we're only including those people in the content item).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah nice that makes sense, thanks

Copy link
Contributor

@hannako hannako left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks Bruce!

@brucebolt brucebolt merged commit 93adc09 into main Jan 30, 2024
12 checks passed
@brucebolt brucebolt deleted the add-wworg-edition-links branch January 30, 2024 13:49
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.

4 participants