Fixed redaction attribute on old nodes and ways, added same
authorMatt Amos <zerebubuth@gmail.com>
Wed, 4 Apr 2012 16:22:33 +0000 (17:22 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 5 Apr 2012 12:53:44 +0000 (13:53 +0100)
functionality to relations.

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

index 9e2c5a40ef3830cbcd50b10ab1d81bf7ed2e4923..3ded52382164d4eabffb7489fc4219c5a89ea763 100644 (file)
@@ -68,7 +68,7 @@ class OldNode < ActiveRecord::Base
     el1['timestamp'] = self.timestamp.xmlschema
     el1['version'] = self.version.to_s
     if self.redacted?
-      el1['redacted'] = self.redaction.title
+      el1['redacted'] = self.redaction.id.to_s
     end
     return el1
   end
index 20651f62259a6e36d04d3b591bfa58e34dbbbf41..34d76ff9c664fb122c955c749871501a1e755247 100644 (file)
@@ -105,20 +105,27 @@ class OldRelation < ActiveRecord::Base
     el1['version'] = self.version.to_s
     el1['changeset'] = self.changeset_id.to_s
     
-    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
+    if self.redacted?
+      el1['redacted'] = self.redaction.id.to_s
     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
+      self.old_tags.each do |tag|
+        e = XML::Node.new 'tag'
+        e['k'] = tag.k
+        e['v'] = tag.v
+        el1 << e
+      end
     end
+
     return el1
   end
 
index ec4bb5136baaa79bf3ce560b017455f83844f7db..e99f6cf28b31fb6a25e61e78df75dcc49ab32287 100644 (file)
@@ -105,7 +105,7 @@ class OldWay < ActiveRecord::Base
     el1['changeset'] = self.changeset.id.to_s
 
     if self.redacted?
-      el1['redacted'] = self.redaction.title
+      el1['redacted'] = self.redaction.id.to_s
     end
     
     unless self.redacted? and (@user.nil? or not @user.moderator?)