]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/changesets_controller.rb
Merge pull request #3973 from tomhughes/one
[rails.git] / app / controllers / api / changesets_controller.rb
index 354b0b9c224b43dc96b569593b8fd3b94d26d80c..56070951a8264292416ac8a57dbc00d58fa117bd 100644 (file)
@@ -4,13 +4,13 @@ module Api
   class ChangesetsController < ApiController
     require "xml/libxml"
 
+    before_action :check_api_writable, :only => [:create, :update, :upload, :subscribe, :unsubscribe]
+    before_action :check_api_readable, :except => [:create, :update, :upload, :download, :query, :subscribe, :unsubscribe]
     before_action :authorize, :only => [:create, :update, :upload, :close, :subscribe, :unsubscribe]
 
     authorize_resource
 
     before_action :require_public_data, :only => [:create, :update, :upload, :close, :subscribe, :unsubscribe]
-    before_action :check_api_writable, :only => [:create, :update, :upload, :subscribe, :unsubscribe]
-    before_action :check_api_readable, :except => [:create, :update, :upload, :download, :query, :subscribe, :unsubscribe]
     before_action :set_request_formats, :except => [:create, :close, :upload]
 
     around_action :api_call_handle_error
@@ -19,6 +19,20 @@ module Api
     # Helper methods for checking consistency
     include ConsistencyValidations
 
+    ##
+    # Return XML giving the basic info about the changeset. Does not
+    # return anything about the nodes, ways and relations in the changeset.
+    def show
+      @changeset = Changeset.find(params[:id])
+      @include_discussion = params[:include_discussion].presence
+      render "changeset"
+
+      respond_to do |format|
+        format.xml
+        format.json
+      end
+    end
+
     # Create a changeset from XML.
     def create
       assert_method :put
@@ -35,20 +49,6 @@ module Api
       render :plain => cs.id.to_s
     end
 
-    ##
-    # Return XML giving the basic info about the changeset. Does not
-    # return anything about the nodes, ways and relations in the changeset.
-    def show
-      @changeset = Changeset.find(params[:id])
-      @include_discussion = params[:include_discussion].presence
-      render "changeset"
-
-      respond_to do |format|
-        format.xml
-        format.json
-      end
-    end
-
     ##
     # marks a changeset as closed. this may be called multiple times
     # on the same changeset, so is idempotent.