]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/amf_controller.rb
Fixed bug #1816 - the timeout updating logic should have been in a before_save handle...
[rails.git] / app / controllers / amf_controller.rb
index c175212e2afa0c875789b2ef2e7bc7a691cad102..0f61b7a4774e7874443d9998bd18edc518ec01a3 100644 (file)
@@ -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<waycreated }
@@ -510,6 +510,7 @@ class AmfController < ApplicationController
         # We're deleting the relation
         relation.delete_with_history!(new_relation, user)
       end
+      updatetimeout(changeset_id)
     end # transaction
       
     if relid <= 0
@@ -633,6 +634,7 @@ class AmfController < ApplicationController
           # and we don't want to delete it
         end
       end
+      updatetimeout(changeset_id)
 
     end # transaction
 
@@ -695,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]
@@ -775,6 +779,7 @@ class AmfController < ApplicationController
           # elsewhere and we don't want to delete it
         end
       end
+      updatetimeout(changeset_id)
 
     end # transaction
     [0, way_id]
@@ -810,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)