X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/7901811752faea37a9fb0f5f05405a5cfbd63b7e..a287d24f127d53de6a049efd798349dc409053ea:/app/controllers/node_controller.rb?ds=inline diff --git a/app/controllers/node_controller.rb b/app/controllers/node_controller.rb index 3f3f882ae..4e2a9b7f2 100644 --- a/app/controllers/node_controller.rb +++ b/app/controllers/node_controller.rb @@ -1,7 +1,9 @@ class NodeController < ApplicationController require 'xml/libxml' + session :off before_filter :authorize, :only => [:create, :update, :delete] + before_filter :check_availability, :only => [:create, :update, :delete] after_filter :compress_output def create @@ -11,12 +13,9 @@ class NodeController < ApplicationController if node node.user_id = @user.id node.visible = true + node.save_with_history! - if node.save_with_history - render :text => node.id.to_s, :content_type => "text/plain" - else - render :nothing => true, :status => :internal_server_error - end + render :text => node.id.to_s, :content_type => "text/plain" else render :nothing => true, :status => :bad_request end @@ -36,8 +35,6 @@ class NodeController < ApplicationController end rescue ActiveRecord::RecordNotFound render :nothing => true, :status => :not_found - rescue - render :nothing => true, :status => :internal_server_error end end @@ -53,12 +50,9 @@ class NodeController < ApplicationController node.latitude = new_node.latitude node.longitude = new_node.longitude node.tags = new_node.tags + node.save_with_history! - if node.save_with_history - render :nothing => true - else - render :nothing => true, :status => :internal_server_error - end + render :nothing => true else render :nothing => true, :status => :bad_request end @@ -67,8 +61,6 @@ class NodeController < ApplicationController end rescue ActiveRecord::RecordNotFound render :nothing => true, :status => :not_found - rescue - render :nothing => true, :status => :internal_server_error end end @@ -82,7 +74,8 @@ class NodeController < ApplicationController else node.user_id = @user.id node.visible = 0 - node.save_with_history + node.save_with_history! + render :nothing => true end else @@ -90,8 +83,6 @@ class NodeController < ApplicationController end rescue ActiveRecord::RecordNotFound render :nothing => true, :status => :not_found - rescue - render :nothing => true, :status => :internal_server_error end end