]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/amf_controller.rb
swap way write with node deletion as per dev@
[rails.git] / app / controllers / amf_controller.rb
index ef2e1c78af30bef54081de56d7dda0ff1f20e3bc..2b21221c0b5e560efaa5d4be1f4c191582d52961 100644 (file)
@@ -397,6 +397,14 @@ class AmfController < ApplicationController
          nodes.push(id)
        end
 
+       # -- Save revised way
+
+       way.tags = attributes
+       way.nds = nodes
+       way.user_id = uid
+       way.visible = true
+       way.save_with_history!
+
        # -- Delete any unique nodes
        
        uniques.each do |n|
@@ -408,14 +416,6 @@ class AmfController < ApplicationController
          node.save_with_history!
        end
 
-       # -- Save revised way
-
-       way.tags = attributes
-       way.nds = nodes
-       way.user_id = uid
-       way.visible = true
-       way.save_with_history!
-
        [0, originalway, way.id, renumberednodes]
   end
 
@@ -487,6 +487,7 @@ class AmfController < ApplicationController
        way.unshared_node_ids.each do |n|
          deleteitemrelations(n, 'node')
        end
+       deleteitemrelations(way_id, 'way')
 
        way.delete_with_relations_and_nodes_and_history(user)