X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/183ffc78648938ca079f7ea5f899d3e71e829333..fac8b5d28aa81f2233c7233b6876ad31d86be28b:/lib/diff_reader.rb diff --git a/lib/diff_reader.rb b/lib/diff_reader.rb index 165e30e20..6a053e4ad 100644 --- a/lib/diff_reader.rb +++ b/lib/diff_reader.rb @@ -79,6 +79,7 @@ class DiffReader ids = { :node => node_ids, :way => way_ids, :relation => rel_ids} result = OSM::API.new.get_xml_doc + result.root.name = "diffResult" # loop at the top level, within the element (although we # don't actually check this...) @@ -99,9 +100,8 @@ class DiffReader # diff, so we must fix these before saving the element. new.fix_placeholders!(ids) - # set the initial version to zero and save (which increments it) - new.version = 0 - new.save_with_history! + # create element given user + new.create_with_history(@changeset.user) # save placeholder => allocated ID map ids[model.to_s.downcase.to_sym][placeholder_id] = new.id @@ -130,8 +130,10 @@ class DiffReader xml_result = XML::Node.new model.to_s.downcase xml_result["old_id"] = old.id.to_s - xml_result["new_id"] = new.id.to_s - xml_result["new_version"] = new.version.to_s + xml_result["new_id"] = new.id.to_s + # version is updated in "old" through the update, so we must not + # return new.version here but old.version! + xml_result["new_version"] = old.version.to_s result.root << xml_result end