diff --git a/app/models/bulk_tagging/bulk_tagging_source.rb b/app/models/bulk_tagging/bulk_tagging_source.rb index 3af62b416..2959ea0b8 100644 --- a/app/models/bulk_tagging/bulk_tagging_source.rb +++ b/app/models/bulk_tagging/bulk_tagging_source.rb @@ -3,7 +3,6 @@ class BulkTaggingSource def source_name_to_content_key_map { document_collection: "documents", - topic: "children", mainstream_browse_page: "children", taxon: "taxon", } diff --git a/app/models/content_item.rb b/app/models/content_item.rb index 75b83b3dd..df02b18d2 100644 --- a/app/models/content_item.rb +++ b/app/models/content_item.rb @@ -51,7 +51,6 @@ def suggested_related_links? def denylisted_tag_types document_denylist = Array(denylist[publishing_app]).map(&:to_sym) - document_denylist += additional_temporary_denylist unless related_links_are_renderable? document_denylist += [:ordered_related_items] @@ -155,8 +154,4 @@ def related_links_are_renderable? written_statement ].include?(document_type) end - - def additional_temporary_denylist - publishing_app == "specialist-publisher" && document_type == "finder" ? [:topics] : [] - end end diff --git a/app/models/tagging/content_item_expanded_links.rb b/app/models/tagging/content_item_expanded_links.rb index 43136b2da..9a108b04d 100644 --- a/app/models/tagging/content_item_expanded_links.rb +++ b/app/models/tagging/content_item_expanded_links.rb @@ -9,7 +9,6 @@ class ContentItemExpandedLinks suggested_ordered_related_items mainstream_browse_pages parent - topics organisations meets_user_needs ].freeze diff --git a/app/services/linkables.rb b/app/services/linkables.rb index 8ed5ce287..ddf41a06a 100644 --- a/app/services/linkables.rb +++ b/app/services/linkables.rb @@ -1,9 +1,5 @@ # Used by Tagging & Bulk Tagging to populate the available tags. class Linkables - def topics - @topics ||= for_nested_document_type("topic") - end - def taxons(exclude_ids: [], include_draft: true) @taxons ||= for_document_type("taxon", include_draft:).tap do |items| if Array(exclude_ids).present? diff --git a/app/views/bulk_tags/new.html.erb b/app/views/bulk_tags/new.html.erb index c20d24b19..ae5011f6e 100644 --- a/app/views/bulk_tags/new.html.erb +++ b/app/views/bulk_tags/new.html.erb @@ -4,7 +4,7 @@ <% end %>
- Search for a topic, mainstream browse page, taxon, or document collection to + Search for a mainstream browse page, taxon, or document collection to bulk tag its content.
diff --git a/app/views/taggings/_form_for_topics.html.erb b/app/views/taggings/_form_for_topics.html.erb deleted file mode 100644 index 96507571e..000000000 --- a/app/views/taggings/_form_for_topics.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -

Specialist topic pages

- -<%= f.input :topics, - collection: linkables.topics, as: :grouped_select, group_method: :last, - placeholder: "Choose specialist topic pages...", - input_html: { multiple: true, include_blank: true, class: :select2 } %> - -

- Specialist topic pages live under /topic. - They contain pages on GOV.UK that have been tagged to the specialist topic. Example: - Business Tax or - Animal Welfare / Pets. - Publishing a page with a specialist topic tag may send out an - email alert to subscribers. -

diff --git a/config/denylisted_tag_types.yml b/config/denylisted_tag_types.yml index cf1c56c87..4ee66b28b 100644 --- a/config/denylisted_tag_types.yml +++ b/config/denylisted_tag_types.yml @@ -16,15 +16,14 @@ default: &default - parent whitehall: - # Specialist topic pages and the parent (breadcrumb) are managed in Whitehall itself. This + # The parent (breadcrumb) is managed in Whitehall itself. This # will stay that way because Whitehall is too complex to make a half-way - # change to a system where topics and breadcrumb are read & written from + # change to a system where breadcrumb is read & written from # the publishing-api. # # Whitehall does send this information to the publishing-api so it can still # be used as a source of information. - parent - - topics # Organisation tagging is done in Whitehall, because its data model is too # much intertwined with organisations to make it read/write this tag from @@ -54,7 +53,7 @@ development: test: <<: *default - test-app-that-can-be-tagged-to-topics-only: + test-app-that-can-be-tagged-to-taxons-only: - mainstream_browse_pages - meets_user_needs - ordered_related_items @@ -62,7 +61,6 @@ test: - suggested_ordered_related_items - organisations - parent - - taxons production: <<: *default diff --git a/config/document_types_excluded_from_the_topic_taxonomy.yml b/config/document_types_excluded_from_the_topic_taxonomy.yml index 8a1e77e5b..ba607031f 100644 --- a/config/document_types_excluded_from_the_topic_taxonomy.yml +++ b/config/document_types_excluded_from_the_topic_taxonomy.yml @@ -48,7 +48,6 @@ document_types: - special_route - staff_update - taxon - - topic - topical_event - topical_event_about_page - travel_advice diff --git a/spec/features/bulk_tagging_spec.rb b/spec/features/bulk_tagging_spec.rb index 79b305417..9ee909ad6 100644 --- a/spec/features/bulk_tagging_spec.rb +++ b/spec/features/bulk_tagging_spec.rb @@ -49,16 +49,6 @@ def given_a_collection_with_items_and_some_other_content_groupings stub_publishing_api_has_item(document_collection) - publishing_api_has_content_items( - [{ - content_id: "topic-id", - title: "A Topic", - base_path: "/a-topic", - document_type: "topic", - }], - q: "topic", - ) - publishing_api_has_content_items( [{ content_id: "browse-page-id", @@ -98,10 +88,6 @@ def and_a_set_of_taxons def when_i_search_for_the_collection visit new_bulk_tag_path - fill_in "bulk_tag_query", with: "topic" - click_button I18n.t("bulk_tag.search_button") - expect(page).to have_text("A Topic") - fill_in "bulk_tag_query", with: "browse" click_button I18n.t("bulk_tag.search_button") expect(page).to have_text("A Mainstream Browse Page") diff --git a/spec/features/related_item_tagging_spec.rb b/spec/features/related_item_tagging_spec.rb index 82646c93a..8eaf8475f 100644 --- a/spec/features/related_item_tagging_spec.rb +++ b/spec/features/related_item_tagging_spec.rb @@ -59,7 +59,7 @@ def given_a_content_item_exists def given_we_can_populate_the_dropdowns_with_content_from_publishing_api # In this test we don't care about empty dropdowns - %w[topic taxon organisation mainstream_browse_page need].each do |document_type| + %w[taxon organisation mainstream_browse_page need].each do |document_type| stub_publishing_api_has_linkables([], document_type:) end end @@ -100,7 +100,6 @@ def then_the_publishing_api_is_sent_the_related_item ordered_related_items: %w[a484eaea-eeb6-48fa-92a7-b67c6cd414f6], mainstream_browse_pages: [], parent: [], - topics: [], organisations: [], meets_user_needs: [], ) diff --git a/spec/features/tag_a_page_spec.rb b/spec/features/tag_a_page_spec.rb index 5b956b199..909194820 100644 --- a/spec/features/tag_a_page_spec.rb +++ b/spec/features/tag_a_page_spec.rb @@ -7,7 +7,7 @@ scenario "User looks up and tags a content item" do given_there_is_a_content_item_with_expanded_links( - topics: [example_topic], + taxons: [example_linked_content], ) when_i_visit_edit_a_page @@ -16,15 +16,15 @@ and_the_expected_navigation_link_is_highlighted and_i_see_the_taxon_form - when_i_select_an_additional_topic("Business tax / Pension scheme administration") + when_i_select_an_additional_taxon("Vehicle plating") and_i_submit_the_form then_the_publishing_api_is_sent( - taxons: [], + taxons: ["17f91fdf-a36f-48f0-989c-a056d56876ee", example_linked_content["content_id"]], ordered_related_items: [], + ordered_related_items_overrides: [], mainstream_browse_pages: [], parent: [], - topics: ["e1d6b771-a692-4812-a4e7-7562214286ef", example_topic["content_id"]], organisations: [], meets_user_needs: [], ) @@ -34,25 +34,26 @@ given_there_is_a_content_item_with_no_expanded_links and_i_am_on_the_page_for_the_item - when_i_select_an_additional_topic("Business tax / Pension scheme administration") + when_i_select_an_additional_taxon("Vehicle plating") and_i_submit_the_form then_the_publishing_api_is_sent( - taxons: [], + taxons: %w[17f91fdf-a36f-48f0-989c-a056d56876ee], ordered_related_items: [], mainstream_browse_pages: [], parent: [], - topics: %w[e1d6b771-a692-4812-a4e7-7562214286ef], organisations: [], meets_user_needs: [], ) end scenario "User makes a conflicting change" do - given_there_is_a_content_item_with_expanded_links(topics: [example_topic]) + given_there_is_a_content_item_with_expanded_links( + taxons: [example_linked_content], + ) and_i_am_on_the_page_for_the_item - when_i_select_an_additional_topic("Business tax / Pension scheme administration") + when_i_select_an_additional_taxon("Vehicle plating") and_somebody_else_makes_a_change and_i_submit_the_form @@ -66,7 +67,9 @@ end scenario "User inputs a correct basepath directly in the URL" do - given_there_is_a_content_item_with_expanded_links(topics: [example_topic]) + given_there_is_a_content_item_with_expanded_links( + taxons: [example_linked_content], + ) when_i_type_its_basepath_in_the_url_directly then_i_am_on_the_page_for_the_item and_the_expected_navigation_link_is_highlighted @@ -74,9 +77,11 @@ context "with javascript disabled", type: :feature, js: false do scenario "the user sets a new related link" do - given_there_is_a_content_item_with_expanded_links(ordered_related_items: [example_topic]) + given_there_is_a_content_item_with_expanded_links( + ordered_related_items: [example_linked_content], + ) stub_publishing_api_has_lookups( - example_topic["base_path"] => example_topic["content_id"], + example_linked_content["base_path"] => example_linked_content["content_id"], "/pay-vat" => "a484eaea-eeb6-48fa-92a7-b67c6cd414f6", ) and_i_am_on_the_page_for_the_item @@ -85,19 +90,20 @@ then_the_publishing_api_is_sent( taxons: [], - ordered_related_items: [example_topic["content_id"], "a484eaea-eeb6-48fa-92a7-b67c6cd414f6"], + ordered_related_items: [example_linked_content["content_id"], "a484eaea-eeb6-48fa-92a7-b67c6cd414f6"], mainstream_browse_pages: [], parent: [], - topics: [], organisations: [], meets_user_needs: [], ) end scenario "the user sets an invalid related link" do - given_there_is_a_content_item_with_expanded_links(ordered_related_items: [example_topic]) + given_there_is_a_content_item_with_expanded_links( + ordered_related_items: [example_linked_content], + ) stub_publishing_api_has_lookups( - example_topic["base_path"] => example_topic["content_id"], + example_linked_content["base_path"] => example_linked_content["content_id"], ) and_i_am_on_the_page_for_the_item when_i_fill_in_related_items(2 => "/pay-cat") @@ -108,9 +114,11 @@ end scenario "the user sets a new valid and invalid related link" do - given_there_is_a_content_item_with_expanded_links(ordered_related_items: [example_topic]) + given_there_is_a_content_item_with_expanded_links( + ordered_related_items: [example_linked_content], + ) stub_publishing_api_has_lookups( - example_topic["base_path"] => example_topic["content_id"], + example_linked_content["base_path"] => example_linked_content["content_id"], "/pay-vat" => "a484eaea-eeb6-48fa-92a7-b67c6cd414f6", ) and_i_am_on_the_page_for_the_item @@ -123,9 +131,11 @@ end scenario "the user changes a suggested related link to be invalid" do - given_there_is_a_content_item_with_expanded_links(suggested_ordered_related_items: [example_topic]) + given_there_is_a_content_item_with_expanded_links( + suggested_ordered_related_items: [example_linked_content], + ) stub_publishing_api_has_lookups( - example_topic["base_path"] => example_topic["content_id"], + example_linked_content["base_path"] => example_linked_content["content_id"], ) and_i_am_on_the_page_for_the_item when_i_fill_in_related_items(6 => "/pay-cat") @@ -136,9 +146,11 @@ end scenario "the user removes suggested related links" do - given_there_is_a_content_item_with_expanded_links(suggested_ordered_related_items: [example_topic]) + given_there_is_a_content_item_with_expanded_links( + suggested_ordered_related_items: [example_linked_content], + ) stub_publishing_api_has_lookups( - example_topic["base_path"] => example_topic["content_id"], + example_linked_content["base_path"] => example_linked_content["content_id"], "/pay-vat" => "a484eaea-eeb6-48fa-92a7-b67c6cd414f6", ) and_i_am_on_the_page_for_the_item @@ -150,7 +162,6 @@ suggested_ordered_related_items: [], mainstream_browse_pages: [], parent: [], - topics: [], organisations: [], meets_user_needs: [], ) @@ -159,7 +170,7 @@ scenario "the user does not see suggested related links when no suggested links exist" do given_there_is_a_content_item_with_expanded_links(ordered_related_items: []) stub_publishing_api_has_lookups( - example_topic["base_path"] => example_topic["content_id"], + example_linked_content["base_path"] => example_linked_content["content_id"], "/pay-vat" => "a484eaea-eeb6-48fa-92a7-b67c6cd414f6", ) and_i_am_on_the_page_for_the_item @@ -266,11 +277,11 @@ def and_i_see_the_url_is_invalid expect(page).to have_content "Not a known URL on GOV.UK" end - def when_i_select_an_additional_topic(selection) + def when_i_select_an_additional_taxon(selection) @tagging_request = stub_request(:patch, "#{Plek.find('publishing-api')}/v2/links/MY-CONTENT-ID") .to_return(status: 200) - select selection, from: "Topics" + select selection, from: "Taxons" end def and_somebody_else_makes_a_change @@ -296,16 +307,10 @@ def then_the_publishing_api_is_sent(**links) end def given_we_can_populate_the_dropdowns_with_content_from_publishing_api - publishing_api_has_topic_linkables( - [ - "/topic/id-of-already-tagged", - "/topic/business-tax/pension-scheme-administration", - ], - ) - publishing_api_has_taxon_linkables( [ "/alpha-taxonomy/vehicle-plating", + "/alpha-taxonomy/vehicle-weights-explained", ], ) @@ -328,9 +333,9 @@ def given_we_can_populate_the_dropdowns_with_content_from_publishing_api ) end - def example_topic + def example_linked_content { - "content_id" => "ID-OF-ALREADY-TAGGED", + "content_id" => "4b5e77f7-69e5-45a9-9061-348cdce876fb", "base_path" => "/already-tagged", "title" => "Already tagged", } diff --git a/spec/features/tagging_during_migration_spec.rb b/spec/features/tagging_during_migration_spec.rb index b907e5c79..adbd22f8d 100644 --- a/spec/features/tagging_during_migration_spec.rb +++ b/spec/features/tagging_during_migration_spec.rb @@ -18,10 +18,10 @@ end def given_we_can_populate_the_dropdowns_with_content_from_publishing_api - publishing_api_has_topic_linkables( + publishing_api_has_taxon_linkables( [ - "/topic/id-of-already-tagged", - "/topic/business-tax/pension-scheme-administration", + "/alpha-taxonomy/vehicle-weights-explained", + "/alpha-taxonomy/vehicle-plating", ], ) publishing_api_has_need_linkables( @@ -39,7 +39,7 @@ def given_there_is_an_item_that_can_have_only_one_link_type stub_request(:get, "#{Plek.find('publishing-api')}/v2/content/MY-CONTENT-ID") .to_return(body: { # see denylisted_tag_types.yml for this - publishing_app: "test-app-that-can-be-tagged-to-topics-only", + publishing_app: "test-app-that-can-be-tagged-to-taxons-only", content_id: "MY-CONTENT-ID", base_path: "/my-content-item", document_type: "mainstream_browse_page", @@ -50,7 +50,7 @@ def given_there_is_an_item_that_can_have_only_one_link_type .to_return(body: { content_id: "MY-CONTENT-ID", expanded_links: { - topics: [{ "content_id": "ID-OF-ALREADY-TAGGED" }], + taxons: [{ "content_id": "4b5e77f7-69e5-45a9-9061-348cdce876fb" }], mainstream_browse_pages: [{ "content_id": "ID-OF-ALREADY-TAGGED-BROWSE-PAGE" }], }, version: 54_321, @@ -67,7 +67,7 @@ def and_i_submit_the_url_of_the_content_item end def when_i_add_an_additional_tag - select "Business tax / Pension scheme administration", from: "Topics" + select "Vehicle plating", from: "Taxons" end def and_i_submit_the_form @@ -80,7 +80,7 @@ def and_i_submit_the_form def then_only_that_link_type_is_sent_to_the_publishing_api body = { links: { - topics: %w[e1d6b771-a692-4812-a4e7-7562214286ef ID-OF-ALREADY-TAGGED], + taxons: %w[17f91fdf-a36f-48f0-989c-a056d56876ee 4b5e77f7-69e5-45a9-9061-348cdce876fb], }, previous_version: 54_321, } diff --git a/spec/models/bulk_tagging/bulk_tagging_source_spec.rb b/spec/models/bulk_tagging/bulk_tagging_source_spec.rb index a90844065..c54040458 100644 --- a/spec/models/bulk_tagging/bulk_tagging_source_spec.rb +++ b/spec/models/bulk_tagging/bulk_tagging_source_spec.rb @@ -3,7 +3,7 @@ module BulkTagging describe "#source_names" do it "returns the names of all supported link types" do expect(described_class.new.source_names).to eq( - %i[document_collection topic mainstream_browse_page taxon], + %i[document_collection mainstream_browse_page taxon], ) end end @@ -11,7 +11,6 @@ module BulkTagging describe "#content_key_for(source_name)" do it "correctly returns the content key for the given source name" do expect(described_class.new.content_key_for(:document_collection)).to eq "documents" - expect(described_class.new.content_key_for("topic")).to eq "children" expect(described_class.new.content_key_for(:mainstream_browse_page)).to eq "children" expect(described_class.new.content_key_for(:taxon)).to eq "taxon" end diff --git a/spec/models/content_item_spec.rb b/spec/models/content_item_spec.rb index bdffc3012..9a9a6bd3e 100644 --- a/spec/models/content_item_spec.rb +++ b/spec/models/content_item_spec.rb @@ -9,14 +9,6 @@ expect(content_item.denylisted_tag_types).to include(:foo, :bar) end - it "includes topics for specialist-publisher docs" do - content_item = build_content_item( - data: { document_type: "finder", publishing_app: "specialist-publisher" }, - ) - - expect(content_item.denylisted_tag_types).to include(:topics) - end - it "includes related items by default" do content_item = build_content_item( data: { document_type: "literally-anything" }, diff --git a/spec/services/linkables_spec.rb b/spec/services/linkables_spec.rb index 732a86085..1751bf69f 100644 --- a/spec/services/linkables_spec.rb +++ b/spec/services/linkables_spec.rb @@ -62,40 +62,6 @@ end end - describe ".topics" do - it "returns an array of hashes with title and content id pairs" do - stub_publishing_api_has_linkables( - [ - { - "public_updated_at" => "2016-04-07 10:34:05", - "title" => "Pension scheme administration", - "content_id" => "e1d6b771-a692-4812-a4e7-7562214286ef", - "publication_state" => "published", - "base_path" => "/topic/business-tax/pension-scheme-administration", - "internal_name" => "Business tax / Pension scheme administration", - }, - { - "public_updated_at" => "2016-04-07 10:34:05", - "title" => nil, - "content_id" => "3535b8ad-7209-4c97-9dac-e25c25d9c27c", - "publication_state" => "published", - "base_path" => "/topic/redirect", - "internal_name" => nil, - }, - ], - document_type: "topic", - ) - - expected = { - "Business tax" => [ - ["Business tax / Pension scheme administration", "e1d6b771-a692-4812-a4e7-7562214286ef"], - ], - } - - expect(linkables.topics).to eq expected - end - end - describe ".organisations" do it "returns an array of arrays with title and content id pairs" do stub_publishing_api_has_linkables( diff --git a/spec/services/taxonomy/build_taxon_spec.rb b/spec/services/taxonomy/build_taxon_spec.rb index d38174782..48ec93128 100644 --- a/spec/services/taxonomy/build_taxon_spec.rb +++ b/spec/services/taxonomy/build_taxon_spec.rb @@ -35,7 +35,6 @@ stub_publishing_api_has_expanded_links({ content_id:, expanded_links: { - topics: [], parent_taxons: [], }, }) @@ -93,9 +92,7 @@ before do stub_publishing_api_has_expanded_links({ content_id:, - expanded_links: { - topics: [], - }, + expanded_links: {}, }) end @@ -111,7 +108,6 @@ stub_publishing_api_has_expanded_links({ content_id:, expanded_links: { - topics: [], parent_taxons: [ { content_id: parent_taxon_id }, ], @@ -129,7 +125,6 @@ stub_publishing_api_has_expanded_links({ content_id:, expanded_links: { - topics: [], parent_taxons: [], root_taxon: [ { content_id: GovukTaxonomy::ROOT_CONTENT_ID }, diff --git a/spec/support/publishing_api_helper.rb b/spec/support/publishing_api_helper.rb index 26b2bea30..f9dc3ab9a 100644 --- a/spec/support/publishing_api_helper.rb +++ b/spec/support/publishing_api_helper.rb @@ -88,13 +88,6 @@ def publishing_api_has_taxon_linkables(base_paths) ) end - def publishing_api_has_topic_linkables(base_paths) - stub_publishing_api_has_linkables( - select_by_base_path(stubbed_topics, base_paths), - document_type: "topic", - ) - end - def publishing_api_has_organisation_linkables(base_paths) stub_publishing_api_has_linkables( select_by_base_path(stubbed_organisations, base_paths), @@ -141,27 +134,6 @@ def stubbed_taxons ] end - def stubbed_topics - [ - { - "public_updated_at" => "2016-04-06 16:25:37.238", - "title" => "ID OF ALREADY TAGGED", - "content_id" => "ID-OF-ALREADY-TAGGED", - "publication_state" => "published", - "base_path" => "/topic/id-of-already-tagged", - "internal_name" => "Test / Id of already tagged", - }, - { - "public_updated_at" => "2016-04-07 10:34:05", - "title" => "Pension scheme administration", - "content_id" => "e1d6b771-a692-4812-a4e7-7562214286ef", - "publication_state" => "published", - "base_path" => "/topic/business-tax/pension-scheme-administration", - "internal_name" => "Business tax / Pension scheme administration", - }, - ] - end - def stubbed_organisations [ {