From: Tom Hughes Date: Tue, 26 Mar 2024 18:32:52 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/4625' X-Git-Tag: live~1168 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/af5d76ecabb8b6a6b35d8df262806367ec4a87cc?hp=f0d05c20ae4cbf05eac73ece0d0357bc2c33bbad Merge remote-tracking branch 'upstream/pull/4625' --- diff --git a/Gemfile.lock b/Gemfile.lock index 77cf3dc19..486757ac2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -95,7 +95,7 @@ GEM autoprefixer-rails (10.4.16.0) execjs (~> 2) aws-eventstream (1.3.0) - aws-partitions (1.899.0) + aws-partitions (1.900.0) aws-sdk-core (3.191.4) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) @@ -307,7 +307,7 @@ GEM kramdown (2.4.0) rexml language_server-protocol (3.17.0.3) - libv8-node (18.16.0.0) + libv8-node (18.19.0.0) libxml-ruby (5.0.3) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) @@ -329,8 +329,8 @@ GEM mini_magick (4.12.0) mini_mime (1.1.5) mini_portile2 (2.8.5) - mini_racer (0.8.0) - libv8-node (~> 18.16.0.0) + mini_racer (0.9.0) + libv8-node (~> 18.19.0.0) minitest (5.22.3) minitest-focus (1.4.0) minitest (>= 4, < 6) @@ -347,9 +347,9 @@ GEM net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - nio4r (2.7.0) + nio4r (2.7.1) nokogiri (1.16.3) mini_portile2 (~> 2.8.2) racc (~> 1.4) @@ -414,7 +414,7 @@ GEM nio4r (~> 2.0) quad_tile (1.0.1) racc (1.7.3) - rack (2.2.8.1) + rack (2.2.9) rack-cors (2.0.2) rack (>= 2.0.0) rack-openid (1.4.2) @@ -472,10 +472,10 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rdoc (6.6.2) + rdoc (6.6.3.1) psych (>= 4.0.0) regexp_parser (2.9.0) - reline (0.4.3) + reline (0.5.0) io-console (~> 0.5) request_store (1.6.0) rack (>= 1.4) @@ -508,7 +508,7 @@ GEM rubocop-performance (1.20.2) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.30.0, < 2.0) - rubocop-rails (2.24.0) + rubocop-rails (2.24.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -563,7 +563,7 @@ GEM thor (1.3.1) tilt (2.3.0) timeout (0.4.1) - turbo-rails (2.0.4) + turbo-rails (2.0.5) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) @@ -574,7 +574,7 @@ GEM validates_email_format_of (1.7.2) i18n vendorer (0.2.0) - version_gem (1.1.3) + version_gem (1.1.4) webmock (3.23.0) addressable (>= 2.8.0) crack (>= 0.3.2) diff --git a/app/controllers/api/changesets_controller.rb b/app/controllers/api/changesets_controller.rb index 60e6f25d8..9a179135f 100644 --- a/app/controllers/api/changesets_controller.rb +++ b/app/controllers/api/changesets_controller.rb @@ -40,8 +40,6 @@ module Api # Create a changeset from XML. def create - assert_method :put - cs = Changeset.from_xml(request.raw_post, :create => true) # Assume that Changeset.from_xml has thrown an exception if there is an error parsing the xml @@ -58,8 +56,6 @@ module Api # marks a changeset as closed. this may be called multiple times # on the same changeset, so is idempotent. def close - assert_method :put - changeset = Changeset.find(params[:id]) check_changeset_consistency(changeset, current_user) @@ -85,12 +81,6 @@ module Api # Returns: a diffResult document, as described in # http://wiki.openstreetmap.org/wiki/OSM_Protocol_Version_0.6 def upload - # only allow POST requests, as the upload method is most definitely - # not idempotent, as several uploads with placeholder IDs will have - # different side-effects. - # see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1.2 - assert_method :post - changeset = Changeset.find(params[:id]) check_changeset_consistency(changeset, current_user) @@ -205,9 +195,6 @@ module Api # # after succesful update, returns the XML of the changeset. def update - # request *must* be a PUT. - assert_method :put - @changeset = Changeset.find(params[:id]) new_changeset = Changeset.from_xml(request.raw_post) diff --git a/app/controllers/api/nodes_controller.rb b/app/controllers/api/nodes_controller.rb index fb808828c..0604aa356 100644 --- a/app/controllers/api/nodes_controller.rb +++ b/app/controllers/api/nodes_controller.rb @@ -52,8 +52,6 @@ module Api # Create a node from XML. def create - assert_method :put - node = Node.from_xml(request.raw_post, :create => true) # Assume that Node.from_xml has thrown an exception if there is an error parsing the xml diff --git a/app/controllers/api/relations_controller.rb b/app/controllers/api/relations_controller.rb index e833ae830..3ce39c4cf 100644 --- a/app/controllers/api/relations_controller.rb +++ b/app/controllers/api/relations_controller.rb @@ -45,8 +45,6 @@ module Api end def create - assert_method :put - relation = Relation.from_xml(request.raw_post, :create => true) # Assume that Relation.from_xml has thrown an exception if there is an error parsing the xml diff --git a/app/controllers/api/users_controller.rb b/app/controllers/api/users_controller.rb index ab48a5189..6fa47095a 100644 --- a/app/controllers/api/users_controller.rb +++ b/app/controllers/api/users_controller.rb @@ -8,7 +8,7 @@ module Api authorize_resource around_action :api_call_handle_error - before_action :lookup_user_by_id, :only => [:show] + load_resource :only => :show before_action :set_request_formats, :except => [:gpx_files] @@ -56,14 +56,6 @@ module Api private - ## - # ensure that there is a "user" instance variable - def lookup_user_by_id - @user = User.find(params[:id]) - end - - ## - # def disable_terms_redirect # this is necessary otherwise going to the user terms page, when # having not agreed already would cause an infinite redirect loop. diff --git a/app/controllers/api/ways_controller.rb b/app/controllers/api/ways_controller.rb index 5e72cfe20..0828e311f 100644 --- a/app/controllers/api/ways_controller.rb +++ b/app/controllers/api/ways_controller.rb @@ -47,8 +47,6 @@ module Api end def create - assert_method :put - way = Way.from_xml(request.raw_post, :create => true) # Assume that Way.from_xml has thrown an exception if there is an error parsing the xml diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 686e81630..e4e156ee8 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -164,14 +164,6 @@ class ApiController < ApplicationController report_error "#{e.class}: #{e.message}", :internal_server_error end - ## - # asserts that the request method is the +method+ given as a parameter - # or raises a suitable error. +method+ should be a symbol, e.g: :put or :get. - def assert_method(method) - ok = request.send(:"#{method.to_s.downcase}?") - raise OSM::APIBadMethodError, method unless ok - end - ## # wrap an api call in a timeout def api_call_timeout(&block) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 253945b9b..9da3f8f04 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -213,10 +213,10 @@
<%= @user.email %>
<% unless @user.creation_ip.nil? -%>
<%= t ".created from" %>
-
<%= @user.creation_ip %>
+
<%= link_to @user.creation_ip, users_path(:ip => @user.creation_ip) %>
<% end -%>
<%= t ".status" %>
-
<%= @user.status.capitalize %>
+
<%= link_to @user.status.capitalize, users_path(:status => @user.status) %>
<%= t ".spam score" %>
<%= @user.spam_score %>