Skip to content

Commit 30c93d2

Browse files
author
Christopher Baines
committed
Clean up the WorldLocationBasePath class
As far as I can work out, this is never used. The only document type that uses the metadata, which is I think where this is possibly used is travel advice. I checked if any travel advice content is tagged to world locations, and it isn't. This is very confusing, as the exceptional cases aren't exceptional. Looking at the code, the behaviour looks to be the same with or without them. I've also removed the comment, as the situation with the migration of "world locations to a taxonomy based model" is pretty uncertian, as the Topic Taxonomy doesn't have anything to do with country classification (it's about subject, not geography), and this "temporary solution" both as far as I can work out, doesn't do anything, and has been here for over a year.
1 parent 75d05d7 commit 30c93d2

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

app/services/world_location_base_path.rb

+1-28
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,11 @@
1-
#This is intended as a temporary solution while dependencies on other apps are
2-
#resolved. We are migrating world locations to a taxonomy based model but the
3-
#following problems have arisen that this approach temporarily solves:
4-
#
5-
# * we require world locations to be associated with content in Whitehall
6-
# for email subscriptions to work so we can't just get rid of them
7-
# * we also need them as not all content will be part of the taxonomy
8-
# (e.g. news about the country)
9-
# * the taxon will take the base path (/world/<country-slug>) and so the
10-
# WorldLocation can't occupy that
11-
# * we need to redirect old /government/world/<country-slug> urls to the new
12-
# taxon but if we leave WorldLocation with that path it will a) overwrite
13-
# the redirect route every time it is updated and b) we'll be knowingly
14-
# linking to a redirect
15-
#
16-
#A slightly better solution will be for Whitehall to retrieve the taxon path from
17-
#publishing API and send that with the world location link as an additional field
18-
#in the links. We'll need the taxonomy to exist in order to implement this. This
19-
#will still require frontend code to know about the links but will be similar
20-
#to prior art we have for some links to be affected by elements with `detail`.
21-
221
class WorldLocationBasePath
23-
EXCEPTIONAL_CASES = {
24-
"Democratic Republic of Congo" => "democratic-republic-of-congo",
25-
"South Georgia and the South Sandwich Islands" => "south-georgia-and-the-south-sandwich-islands",
26-
"St Pierre & Miquelon" => "st-pierre-miquelon"
27-
}.freeze
28-
292
class << self
303
def for(world_location_link)
314
base_path = world_location_link["base_path"]
325
title = world_location_link["title"]
336
return base_path if base_path.present?
347

35-
slug = EXCEPTIONAL_CASES[title] || title.parameterize
8+
slug = title.parameterize
369

3710
"/world/#{slug}/news"
3811
end

0 commit comments

Comments
 (0)