2 extend ActiveSupport::Concern
4 def add_metadata_to_xml_node(el, osm, changeset_cache, user_display_name_cache)
5 el["changeset"] = osm.changeset_id.to_s
6 el["redacted"] = osm.redaction.id.to_s if osm.redacted?
7 el["timestamp"] = osm.timestamp.xmlschema
8 el["version"] = osm.version.to_s
9 el["visible"] = osm.visible.to_s
11 if changeset_cache.key?(osm.changeset_id)
12 # use the cache if available
14 changeset_cache[osm.changeset_id] = osm.changeset.user_id
17 user_id = changeset_cache[osm.changeset_id]
19 if user_display_name_cache.key?(user_id)
20 # use the cache if available
21 elsif osm.changeset.user.data_public?
22 user_display_name_cache[user_id] = osm.changeset.user.display_name
24 user_display_name_cache[user_id] = nil
27 unless user_display_name_cache[user_id].nil?
28 el["user"] = user_display_name_cache[user_id]
29 el["uid"] = user_id.to_s
33 def add_tags_to_xml_node(el, tags)
35 tag_el = XML::Node.new("tag")