From b5a3ff35986f82b404184bbab595e0cb3ac7d6e2 Mon Sep 17 00:00:00 2001 From: BeckaL Date: Mon, 26 Jun 2023 13:57:56 +0100 Subject: [PATCH 1/2] Add temporary rake task to unpublish help.json This page was retired when frontend's json api was retired: https://github.com/alphagov/frontend/pull/1180 and the page (www.gov.uk/help.json) has been 404ing since then. This adds a temporary rake task to unpublish the page and redirect it to /help. This rake task can be removed once it has been run. --- lib/tasks/publishing_api.rake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/tasks/publishing_api.rake b/lib/tasks/publishing_api.rake index ecdcccf381..bddb401b92 100644 --- a/lib/tasks/publishing_api.rake +++ b/lib/tasks/publishing_api.rake @@ -27,4 +27,9 @@ namespace :publishing_api do I18n.locale = :cy CalendarPublisher.new(Calendar.find("bank-holidays"), slug: "gwyliau-banc").publish end + + desc "Unpublish help.json" + task unpublish_help_json: :environment do + Services.publishing_api.unpublish("50aa0d27-ea4a-49b7-a1e6-98abd1115f60", type: "redirect", alternative_path: "/help", discard_drafts: true) + end end From c4bec8f2674b10368de111b2112e82bbffb34007 Mon Sep 17 00:00:00 2001 From: BeckaL Date: Mon, 26 Jun 2023 14:00:17 +0100 Subject: [PATCH 2/2] Remove help.json special route This page was retired when frontend's json api was retired: https://github.com/alphagov/frontend/pull/1180 and the page (www.gov.uk/help.json) has been 404ing since then, however the page was not fully cleaned up and remained published by the special route publisher class. We're going to unpublish the page via a rake task, so we can remove it from the list of pages published here. --- lib/special_route_publisher.rb | 6 ------ lib/tasks/publishing_api.rake | 3 ++- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/special_route_publisher.rb b/lib/special_route_publisher.rb index 2eaea6bdb2..1ac6da0df8 100644 --- a/lib/special_route_publisher.rb +++ b/lib/special_route_publisher.rb @@ -48,12 +48,6 @@ def self.routes title: "Cookies on GOV.UK", description: "You can choose which cookies you're happy for GOV.UK to use.", }, - { - content_id: "50aa0d27-ea4a-49b7-a1e6-98abd1115f60", - base_path: "/help.json", - title: "Help using GOV.UK", - description: "Find out about GOV.UK, including the use of cookies, accessibility of the site, the privacy notice and terms and conditions of use rendered in JSON format here.", - }, { content_id: "3c991cea-cdee-4e58-b8d1-d38e7c0e6327", base_path: "/random", diff --git a/lib/tasks/publishing_api.rake b/lib/tasks/publishing_api.rake index bddb401b92..53f65e5a4b 100644 --- a/lib/tasks/publishing_api.rake +++ b/lib/tasks/publishing_api.rake @@ -30,6 +30,7 @@ namespace :publishing_api do desc "Unpublish help.json" task unpublish_help_json: :environment do - Services.publishing_api.unpublish("50aa0d27-ea4a-49b7-a1e6-98abd1115f60", type: "redirect", alternative_path: "/help", discard_drafts: true) + api_client = GdsApi::PublishingApi.new(Plek.find("publishing-api"), bearer_token: ENV["PUBLISHING_API_BEARER_TOKEN"]) + api_client.unpublish("50aa0d27-ea4a-49b7-a1e6-98abd1115f60", type: "redirect", alternative_path: "/help", discard_drafts: true) end end