X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e1b205913c9afd6b41684add7308cef4613112e2..734cbb967de8e04f15e01ee2103033064dd290d4:/app/controllers/relation_controller.rb diff --git a/app/controllers/relation_controller.rb b/app/controllers/relation_controller.rb index b38d90c02..b77d41ead 100644 --- a/app/controllers/relation_controller.rb +++ b/app/controllers/relation_controller.rb @@ -46,6 +46,7 @@ class RelationController < ApplicationController end def update + logger.debug request.raw_post begin relation = Relation.find(params[:id]) new_relation = Relation.from_xml(request.raw_post) @@ -67,7 +68,13 @@ class RelationController < ApplicationController #XXX check if member somewhere! begin relation = Relation.find(params[:id]) - relation.delete_with_history(@user) + new_relation = Relation.from_xml(request.raw_post) + if new_relation and new_relation.id == relation.id + relation.delete_with_history(new_relation, @user) + render :nothing => true, :status => :success + else + render :nothing => true, :status => :bad_request + end rescue OSM::APIError => ex render ex.render_opts rescue ActiveRecord::RecordNotFound