Skip to content

Commit

Permalink
Merge pull request #1152 from alphagov/remove-council-external-links
Browse files Browse the repository at this point in the history
Add once_off rake task to unpublish/destroy all external links that are council homepages
  • Loading branch information
KludgeKML authored Mar 19, 2024
2 parents 1a1e0d9 + d2f57a3 commit f353f70
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/tasks/once_off/remove_council_external_links.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# External links to council homepages are now published and managed
# by Local Links Manager.
namespace :once_off do
desc "Unpublish all external links that are council homepages"
task remove_council_external_links: :environment do
non_councils = [
"Corporation of London",
"Comhairle nan Eilean Siar",
"City and County of Swansea",
]

council_links = RecommendedLink.where("title LIKE '%Council%'") + RecommendedLink.where(title: non_councils)
council_links.each do |link|
ExternalContentPublisher.unpublish(link)
link.destroy!
end
end
end

0 comments on commit f353f70

Please sign in to comment.