Commit f23dc096 authored by Zhu Shung's avatar Zhu Shung

Add route patch for JH and modify country

parent f5a67298
...@@ -184,6 +184,10 @@ Rails.application.routes.draw do ...@@ -184,6 +184,10 @@ Rails.application.routes.draw do
resources :survey_responses, only: :index resources :survey_responses, only: :index
end end
Gitlab.jh do
draw :province
end
if ENV['GITLAB_CHAOS_SECRET'] || Rails.env.development? || Rails.env.test? if ENV['GITLAB_CHAOS_SECRET'] || Rails.env.development? || Rails.env.test?
resource :chaos, only: [] do resource :chaos, only: [] do
get :leakmem get :leakmem
......
...@@ -5,6 +5,7 @@ module World ...@@ -5,6 +5,7 @@ module World
extend self extend self
DENYLIST = ['Iran (Islamic Republic of)', 'Sudan', 'Syrian Arab Republic', 'Korea (Democratic People\'s Republic of)', 'Cuba'].freeze DENYLIST = ['Iran (Islamic Republic of)', 'Sudan', 'Syrian Arab Republic', 'Korea (Democratic People\'s Republic of)', 'Cuba'].freeze
JH_MARKET = ['China', 'Hong Kong', 'Macao'].freeze
def countries_for_select def countries_for_select
strong_memoize(:countries_for_select) { all_countries.sort_by(&:name).map { |c| [c.name, c.alpha2] } } strong_memoize(:countries_for_select) { all_countries.sort_by(&:name).map { |c| [c.name, c.alpha2] } }
...@@ -23,7 +24,7 @@ module World ...@@ -23,7 +24,7 @@ module World
end end
def all_countries def all_countries
strong_memoize(:all_countries) { ISO3166::Country.all.reject {|item| DENYLIST.include?(item.name) } } strong_memoize(:all_countries) { ISO3166::Country.all.reject {|item| DENYLIST.include?(item.name) || JH_MARKET.include?(item.name) } }
end end
def alpha3_from_alpha2(alpha2) def alpha3_from_alpha2(alpha2)
......
...@@ -20,6 +20,7 @@ RSpec.describe CountriesController do ...@@ -20,6 +20,7 @@ RSpec.describe CountriesController do
resultant_countries = json_response.map {|row| row[0]} resultant_countries = json_response.map {|row| row[0]}
expect(resultant_countries).not_to include(World::DENYLIST) expect(resultant_countries).not_to include(World::DENYLIST)
expect(resultant_countries).not_to include(World::JH_MARKET)
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment