[openstreetmap-website] Deduplicate object metadata code (refactoring) (#611)

Tom Hughes notifications at github.com
Tue Dec 3 19:45:41 UTC 2013


> -
> -    user_id = changeset_cache[self.changeset_id]
> -
> -    if user_display_name_cache.key?(user_id)
> -      # use the cache if available
> -    elsif self.changeset.user.data_public?
> -      user_display_name_cache[user_id] = self.changeset.user.display_name
> -    else
> -      user_display_name_cache[user_id] = nil
> -    end
> -
> -    if not user_display_name_cache[user_id].nil?
> -      el1['user'] = user_display_name_cache[user_id]
> -      el1['uid'] = user_id.to_s
> -    end
> +    ObjectMetadata::add_metadata_to_xml_node(el1, self, changeset_cache, user_display_name_cache)

Rather than using `ObjectMetadata::add_metadata_to_xml_node` here add `include ObjectMetadata` at the top and then just use `add_metadata_to_xml_node` instead - there are several other modules being pulled in like that already.

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/611/files#r8072704
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20131203/e3ec4718/attachment.html>


More information about the rails-dev mailing list