X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/41f85fb77dbd0c16f12e49091b14fcaa1264ad70..1ceb4ab9ba10d97333414bf66ae2c9d553668903:/app/controllers/amf_controller.rb diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index 5ff42fdd2..0f61b7a47 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -362,7 +362,7 @@ class AmfController < ApplicationController waycreated=revdates[0] revdates.uniq! revdates.sort! - revdates.reverse! + revdates.reverse! # Remove any dates (from nodes) before first revision date of way revdates.delete_if { |d| d ex + # We don't do anything here as the node is being used elsewhere + # and we don't want to delete it + end end + updatetimeout(changeset_id) end # transaction @@ -690,7 +697,9 @@ class AmfController < ApplicationController # We're deleting the node node.delete_with_history!(new_node, user) end - end # transaction + updatetimeout(changeset_id) + + end # transaction if id <= 0 return [0, id, new_node.id, new_node.version] @@ -763,8 +772,14 @@ class AmfController < ApplicationController new_node = Node.new new_node.changeset_id = changeset_id new_node.version = v.to_i - node.delete_with_history_unless_used!(new_node, user) + begin + node.delete_with_history!(new_node, user) + rescue OSM::APIPreconditionFailedError => ex + # We don't do anything with the exception as the node is in use + # elsewhere and we don't want to delete it + end end + updatetimeout(changeset_id) end # transaction [0, way_id] @@ -800,6 +815,13 @@ class AmfController < ApplicationController return user end + # save the changeset identified by +changeset_id+. this + # automatically sets the close timeout appropriately. + def updatetimeout(changeset_id) + cs = Changeset.find(changeset_id) + cs.save! + end + # Send AMF response def sendresponse(results)