Removed user checks from to_xml_node, as these should already be
authorMatt Amos <zerebubuth@gmail.com>
Wed, 4 Apr 2012 17:17:23 +0000 (18:17 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 5 Apr 2012 12:53:48 +0000 (13:53 +0100)
handled at the controller level.

app/models/old_node.rb
app/models/old_relation.rb
app/models/old_way.rb

index 3ded52382164d4eabffb7489fc4219c5a89ea763..9426b2d2327331e5e5ab7302ce5dc8c9851f89fc 100644 (file)
@@ -45,16 +45,15 @@ class OldNode < ActiveRecord::Base
   def to_xml_node
     el1 = XML::Node.new 'node'
     el1['id'] = self.node_id.to_s
-    unless self.redacted? and (@user.nil? or not @user.moderator?)
-      self.tags.each do |k,v|
-        el2 = XML::Node.new('tag')
-        el2['k'] = k.to_s
-        el2['v'] = v.to_s
-        el1 << el2
-      end
-      el1['lat'] = self.lat.to_s
-      el1['lon'] = self.lon.to_s
+
+    self.tags.each do |k,v|
+      el2 = XML::Node.new('tag')
+      el2['k'] = k.to_s
+      el2['v'] = v.to_s
+      el1 << el2
     end
+    el1['lat'] = self.lat.to_s
+    el1['lon'] = self.lon.to_s
     
     el1['changeset'] = self.changeset.id.to_s
     if self.changeset.user.data_public?
@@ -62,14 +61,12 @@ class OldNode < ActiveRecord::Base
       el1['uid'] = self.changeset.user.id.to_s
     end
 
-    
-
     el1['visible'] = self.visible.to_s
     el1['timestamp'] = self.timestamp.xmlschema
     el1['version'] = self.version.to_s
-    if self.redacted?
-      el1['redacted'] = self.redaction.id.to_s
-    end
+    
+    el1['redacted'] = self.redaction.id.to_s if self.redacted?
+
     return el1
   end
 
index 34d76ff9c664fb122c955c749871501a1e755247..390c142dbc1b940773b8185b8e352f94f6b2dfe0 100644 (file)
@@ -105,25 +105,21 @@ class OldRelation < ActiveRecord::Base
     el1['version'] = self.version.to_s
     el1['changeset'] = self.changeset_id.to_s
     
-    if self.redacted?
-      el1['redacted'] = self.redaction.id.to_s
+    el1['redacted'] = self.redaction.id.to_s if self.redacted?
+    
+    self.old_members.each do |member|
+      e = XML::Node.new 'member'
+      e['type'] = member.member_type.to_s.downcase
+      e['ref'] = member.member_id.to_s # "id" is considered uncool here as it should be unique in XML
+      e['role'] = member.member_role.to_s
+      el1 << e
     end
     
-    unless self.redacted? and (@user.nil? or not @user.moderator?)
-      self.old_members.each do |member|
-        e = XML::Node.new 'member'
-        e['type'] = member.member_type.to_s.downcase
-        e['ref'] = member.member_id.to_s # "id" is considered uncool here as it should be unique in XML
-        e['role'] = member.member_role.to_s
-        el1 << e
-      end
-      self.old_tags.each do |tag|
-        e = XML::Node.new 'tag'
-        e['k'] = tag.k
-        e['v'] = tag.v
-        el1 << e
-      end
+    self.old_tags.each do |tag|
+      e = XML::Node.new 'tag'
+      e['k'] = tag.k
+      e['v'] = tag.v
+      el1 << e
     end
 
     return el1
index e99f6cf28b31fb6a25e61e78df75dcc49ab32287..bc114d73a512dd49fcad30aebabf02bdb8141974 100644 (file)
@@ -104,26 +104,21 @@ class OldWay < ActiveRecord::Base
     el1['version'] = self.version.to_s
     el1['changeset'] = self.changeset.id.to_s
 
-    if self.redacted?
-      el1['redacted'] = self.redaction.id.to_s
-    end
+    el1['redacted'] = self.redaction.id.to_s if self.redacted?
     
-    unless self.redacted? and (@user.nil? or not @user.moderator?)
-      # If a way is redacted and the user isn't a moderator, only show
-      # meta-data from this revision, but no real data.
-      self.old_nodes.each do |nd| # FIXME need to make sure they come back in the right order
-        e = XML::Node.new 'nd'
-        e['ref'] = nd.node_id.to_s
-        el1 << e
-      end
+    self.old_nodes.each do |nd| # FIXME need to make sure they come back in the right order
+      e = XML::Node.new 'nd'
+      e['ref'] = nd.node_id.to_s
+      el1 << e
+    end
       
-      self.old_tags.each do |tag|
-        e = XML::Node.new 'tag'
-        e['k'] = tag.k
-        e['v'] = tag.v
-        el1 << e
-      end
+    self.old_tags.each do |tag|
+      e = XML::Node.new 'tag'
+      e['k'] = tag.k
+      e['v'] = tag.v
+      el1 << e
     end
+
     return el1
   end