From: Tom Hughes Date: Tue, 14 Jan 2025 19:05:09 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/5495' X-Git-Tag: live~632 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/914fff9d4dec3d502d524f5b0f60797f66f8af65?hp=e9fd07a7999681eca3b86798428067c53bbc5265 Merge remote-tracking branch 'upstream/pull/5495' --- diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 041b7ef5e..b3379b91a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -52,7 +52,6 @@ Lint/AssignmentInCondition: - 'app/helpers/application_helper.rb' - 'app/helpers/browse_tags_helper.rb' - 'app/mailers/user_mailer.rb' - - 'app/models/client_application.rb' - 'lib/nominatim.rb' - 'lib/osm.rb' - 'script/deliver-message' diff --git a/Gemfile.lock b/Gemfile.lock index 068daa360..475ef50c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -92,8 +92,8 @@ GEM autoprefixer-rails (10.4.19.0) execjs (~> 2) aws-eventstream (1.3.0) - aws-partitions (1.1032.0) - aws-sdk-core (3.214.1) + aws-partitions (1.1036.0) + aws-sdk-core (3.215.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) @@ -105,7 +105,7 @@ GEM aws-sdk-core (~> 3, >= 3.210.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.10.1) + aws-sigv4 (1.11.0) aws-eventstream (~> 1, >= 1.0.2) base64 (0.2.0) benchmark (0.4.0) @@ -162,7 +162,7 @@ GEM config (5.5.2) deep_merge (~> 1.2, >= 1.2.1) ostruct - connection_pool (2.4.1) + connection_pool (2.5.0) cork (0.3.0) colored2 (~> 3.1) crack (1.0.0) @@ -260,7 +260,7 @@ GEM smart_properties erubi (1.13.1) execjs (2.10.0) - exifr (1.4.0) + exifr (1.4.1) factory_bot (6.5.0) activesupport (>= 5.0.0) factory_bot_rails (6.4.4) @@ -354,7 +354,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.4) + logger (1.6.5) logstasher (2.1.5) activesupport (>= 5.2) request_store @@ -546,7 +546,7 @@ GEM rouge (4.5.1) rtlcss (0.2.1) mini_racer (>= 0.6.3) - rubocop (1.69.2) + rubocop (1.70.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -631,7 +631,7 @@ GEM terser (1.2.4) execjs (>= 0.3.0, < 3) thor (1.3.2) - tilt (2.5.0) + tilt (2.6.0) timeout (0.4.3) turbo-rails (2.0.11) actionpack (>= 6.0.0) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 25c430f1c..f6006fe5e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -114,7 +114,7 @@ class ApplicationController < ActionController::Base def check_database_writable(need_api: false) if Settings.status == "database_offline" || Settings.status == "database_readonly" || - (need_api && (Settings.status == "api_offline" || Settings.status == "api_readonly")) + (need_api && %w[api_offline api_readonly].include?(Settings.status)) if request.xhr? report_error "Database offline for maintenance", :service_unavailable else @@ -339,7 +339,7 @@ class ApplicationController < ActionController::Base begin referer = URI.parse(referer) - if referer.scheme == "http" || referer.scheme == "https" + if %w[http https].include?(referer.scheme) referer.scheme = nil referer.host = nil referer.port = nil diff --git a/app/controllers/geocoder_controller.rb b/app/controllers/geocoder_controller.rb index 43f276efa..85b4476f6 100644 --- a/app/controllers/geocoder_controller.rb +++ b/app/controllers/geocoder_controller.rb @@ -101,8 +101,9 @@ class GeocoderController < ApplicationController if klass == "boundary" && type == "administrative" rank = (place.attributes["address_rank"].to_i + 1) / 2 prefix_name = t "geocoder.search_osm_nominatim.admin_levels.level#{rank}", :default => prefix_name + place_tags = %w[linked_place place] place.elements["extratags"].elements.each("tag") do |extratag| - prefix_name = t "geocoder.search_osm_nominatim.prefix.place.#{extratag.attributes['value']}", :default => prefix_name if extratag.attributes["key"] == "linked_place" || extratag.attributes["key"] == "place" + prefix_name = t "geocoder.search_osm_nominatim.prefix.place.#{extratag.attributes['value']}", :default => prefix_name if place_tags.include?(extratag.attributes["key"]) end end prefix = t ".prefix_format", :name => prefix_name diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index 58f0a11c9..9adbaa195 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -24,7 +24,7 @@ class SiteController < ApplicationController end def index - session[:location] ||= OSM.ip_location(request.env["REMOTE_ADDR"]) unless Settings.status == "database_readonly" || Settings.status == "database_offline" + session[:location] ||= OSM.ip_location(request.env["REMOTE_ADDR"]) unless %w[database_readonly database_offline].include?(Settings.status) end def permalink diff --git a/app/models/trace.rb b/app/models/trace.rb index 20723b98d..4d71b4b29 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -86,11 +86,11 @@ class Trace < ApplicationRecord end def public? - visibility == "public" || visibility == "identifiable" + %w[public identifiable].include?(visibility) end def trackable? - visibility == "trackable" || visibility == "identifiable" + %w[trackable identifiable].include?(visibility) end def identifiable? diff --git a/config/locales/en.yml b/config/locales/en.yml index d1faa7a50..04b8a9a96 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -20,9 +20,6 @@ en: create: Add Comment message: create: Send - client_application: - create: Register - update: Update oauth2_application: create: Register update: Update