update nodes/ways/relation XML to include user id as well as display name
authorDave Stubbs <osm@randomjunk.co.uk>
Sun, 9 Nov 2008 16:43:09 +0000 (16:43 +0000)
committerDave Stubbs <osm@randomjunk.co.uk>
Sun, 9 Nov 2008 16:43:09 +0000 (16:43 +0000)
app/models/node.rb
app/models/old_node.rb
app/models/old_relation.rb
app/models/old_way.rb
app/models/relation.rb
app/models/way.rb

index cf7aedae88c77692519022e11804678383a0bf6c..391b50dcda335b4cb7ddb1e54cce2ccad1775b51 100644 (file)
@@ -222,7 +222,10 @@ class Node < ActiveRecord::Base
       user_display_name_cache[self.changeset.user_id] = nil
     end
 
-    el1['user'] = user_display_name_cache[self.changeset.user_id] unless user_display_name_cache[self.changeset.user_id].nil?
+    if not user_display_name_cache[self.changeset.user_id].nil?
+      el1['user'] = user_display_name_cache[self.changeset.user_id]
+      el1['uid'] = self.changeset.user_id.to_s
+    end
 
     self.tags.each do |k,v|
       el2 = XML::Node.new('tag')
index 91b5a1a8ea9024519a8372bf5b43a5220a9fdf04..03aff0fc6a578f4d9814929ee1a8e64051c7d910 100644 (file)
@@ -40,7 +40,10 @@ class OldNode < ActiveRecord::Base
     el1['lat'] = self.lat.to_s
     el1['lon'] = self.lon.to_s
     el1['changeset'] = self.changeset.id.to_s
-    el1['user'] = self.changeset.user.display_name if self.changeset.user.data_public?
+    if self.changeset.user.data_public?
+      el1['user'] = self.changeset.user.display_name
+      el1['uid'] = self.changeset.user.id.to_s
+    end
 
     self.tags.each do |k,v|
       el2 = XML::Node.new('tag')
index b7e7248d9bab19b246df2d97f5151d2ed90a7415..491b444a677844f4c9d9db24874abac672226c6a 100644 (file)
@@ -99,7 +99,10 @@ class OldRelation < ActiveRecord::Base
     el1['id'] = self.id.to_s
     el1['visible'] = self.visible.to_s
     el1['timestamp'] = self.timestamp.xmlschema
-    el1['user'] = self.changeset.user.display_name if self.changeset.user.data_public?
+    if self.changeset.user.data_public?
+      el1['user'] = self.changeset.user.display_name
+      el1['uid'] = self.changeset.user.id.to_s
+    end
     el1['version'] = self.version.to_s
     el1['changeset'] = self.changeset_id.to_s
     
index 44155d05c8d58367d0656e62743d1be3dbef2e1d..ce856e208d00072bbcef3d1531029dcb667e0e2e 100644 (file)
@@ -96,7 +96,10 @@ class OldWay < ActiveRecord::Base
     el1['id'] = self.id.to_s
     el1['visible'] = self.visible.to_s
     el1['timestamp'] = self.timestamp.xmlschema
-    el1['user'] = self.changeset.user.display_name if self.changeset.user.data_public?
+    if self.changeset.user.data_public?
+      el1['user'] = self.changeset.user.display_name
+      el1['uid'] = self.changeset.user.id.to_s
+    end
     el1['version'] = self.version.to_s
     el1['changeset'] = self.changeset.id.to_s
     
index be990e589a2135b0c88b714927ce6824bd29d8cb..1bbb1d8e93fc9218224e18872dc87d069486e6b6 100644 (file)
@@ -83,7 +83,10 @@ class Relation < ActiveRecord::Base
       user_display_name_cache[self.changeset.user_id] = nil
     end
 
-    el1['user'] = user_display_name_cache[self.changeset.user_id] unless user_display_name_cache[self.changeset.user_id].nil?
+    if not user_display_name_cache[self.changeset.user_id].nil?
+      el1['user'] = user_display_name_cache[self.changeset.user_id]
+      el1['uid'] = self.changeset.user_id.to_s
+    end
 
     self.relation_members.each do |member|
       p=0
index be6531def4bdeac9b71debd94105282e4379fc93..da7b8d733fbf877867d7e27124b0f75ce6bc66e6 100644 (file)
@@ -101,7 +101,10 @@ class Way < ActiveRecord::Base
       user_display_name_cache[self.changeset.user_id] = nil
     end
 
-    el1['user'] = user_display_name_cache[self.changeset.user_id] unless user_display_name_cache[self.changeset.user_id].nil?
+    if not user_display_name_cache[self.changeset.user_id].nil?
+      el1['user'] = user_display_name_cache[self.changeset.user_id]
+      el1['uid'] = self.changeset.user_id.to_s
+    end
 
     # make sure nodes are output in sequence_id order
     ordered_nodes = []