(CM-413) Fetch organisations from Publishing API#7
Merged
Conversation
c2b1371 to
8ce0c33
Compare
edavey
approved these changes
Sep 1, 2025
Collaborator
edavey
left a comment
There was a problem hiding this comment.
Nice work, rather fiddly!
| }, | ||
| ] | ||
|
|
||
| assert_equal taggable_organisations_container([]), expected |
Collaborator
There was a problem hiding this comment.
I think the signature in mini-test is assert_equal(expected, actual)?
Contributor
Author
There was a problem hiding this comment.
Good call, I always forget which way round that is!
In the next commit we’ll fetch organisation data from the API
This fetches and caches (for 1 day) organisations from Publishing API, marshalling them into `Organisation` objects. The tests set up the cache, so we can ensure it works correctly.
I’ve also updated the factory to support a generic Ruby class, and remove the `ministerial_department` and `non_ministerial_department` scopes.
This drops the `organisations` and `content_block_edition_organisations` tables
This removes the relation, and allows the Organisation object to be returned
Also, set `lead_organisation_id` rather than `organisation`
This was left over from the migration
The content_id field is now called just `id`
We no longer need to join, and can just query by the ID
We may want to put something like this back at a later date, but let’s leave it for now
We are now fetching organisations via the helper
8ce0c33 to
7cbc8ee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now we’re moving away from Whitehall, we no longer have direct access to Organisations in the Whitehall database. We need to fetch these from Publishing API instead. This changes the
Organisationclass to a data class which fetches the Organisation documents directly from the Publishing API (behind a cache). There's a bit of unpicking to do in the rest of the codebase (mainly related to tests), so apologies for the number of commits!We still need to fix linking to organisations (see
content-block-manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.rb
Line 133 in 6f9adc5