From: Tom Hughes Date: Tue, 26 Mar 2019 19:14:04 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/2175' X-Git-Tag: live~2672 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/dcfe326f6515cc7aeb9c02b7536e69863c60cd01 Merge remote-tracking branch 'upstream/pull/2175' --- dcfe326f6515cc7aeb9c02b7536e69863c60cd01 diff --cc app/controllers/geocoder_controller.rb index a877fc092,d9b56147f..4a8f77650 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@@ -15,13 -15,13 +15,13 @@@ class GeocoderController < ApplicationC if @params[:lat] && @params[:lon] @sources.push "latlon" @sources.push "osm_nominatim_reverse" - @sources.push "geonames_reverse" if defined?(GEONAMES_USERNAME) + @sources.push "geonames_reverse" if Settings.key?(:geonames_username) elsif @params[:query] - if @params[:query] =~ /^\d{5}(-\d{4})?$/ + if @params[:query].match?(/^\d{5}(-\d{4})?$/) @sources.push "osm_nominatim" - elsif @params[:query] =~ /^(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\s*[0-9][ABD-HJLNP-UW-Z]{2})$/i + elsif @params[:query].match?(/^(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\s*[0-9][ABD-HJLNP-UW-Z]{2})$/i) @sources.push "osm_nominatim" - elsif @params[:query] =~ /^[A-Z]\d[A-Z]\s*\d[A-Z]\d$/i + elsif @params[:query].match?(/^[A-Z]\d[A-Z]\s*\d[A-Z]\d$/i) @sources.push "ca_postcode" @sources.push "osm_nominatim" else