From 7a216c0ce66e0426613415d887937be729cb26d2 Mon Sep 17 00:00:00 2001 From: Christopher Schmidt Date: Sun, 11 May 2008 19:47:19 +0000 Subject: [PATCH] Make edits return version numbers as plain text strings --- app/controllers/node_controller.rb | 6 +++--- app/controllers/relation_controller.rb | 1 + app/controllers/way_controller.rb | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controllers/node_controller.rb b/app/controllers/node_controller.rb index f6a673fe5..956a8b8d9 100644 --- a/app/controllers/node_controller.rb +++ b/app/controllers/node_controller.rb @@ -15,7 +15,7 @@ class NodeController < ApplicationController node = Node.from_xml(request.raw_post, true) if node - node.version = 0 + node.version = 0 node.user_id = @user.id node.visible = true node.save_with_history! @@ -51,8 +51,8 @@ class NodeController < ApplicationController new_node = Node.from_xml(request.raw_post) if new_node and new_node.id == node.id - node.update_from(new_node, @user) - render :nothing => true + node.update_from(new_node, @user) + render :text => node.version.to_s, :content_type => "text/plain" else render :nothing => true, :status => :bad_request end diff --git a/app/controllers/relation_controller.rb b/app/controllers/relation_controller.rb index caacd4fb9..20f5372a6 100644 --- a/app/controllers/relation_controller.rb +++ b/app/controllers/relation_controller.rb @@ -52,6 +52,7 @@ class RelationController < ApplicationController if new_relation and new_relation.id == relation.id relation.update_from new_relation, user + render :text => relation.version.to_s, :content_type => "text/plain" else render :nothing => true, :status => :bad_request end diff --git a/app/controllers/way_controller.rb b/app/controllers/way_controller.rb index 3f5f66197..94a10d424 100644 --- a/app/controllers/way_controller.rb +++ b/app/controllers/way_controller.rb @@ -15,7 +15,7 @@ class WayController < ApplicationController if !way.preconditions_ok? render :text => "", :status => :precondition_failed else - way.version = 0 + way.version = 0 way.user_id = @user.id way.save_with_history! @@ -51,8 +51,8 @@ class WayController < ApplicationController new_way = Way.from_xml(request.raw_post) if new_way and new_way.id == way.id - way.update_from(new_way, @user) - render :nothing => true + way.update_from(new_way, @user) + render :text => way.version.to_s, :content_type => "text/plain" else render :nothing => true, :status => :bad_request end -- 2.43.2