From: Tom Hughes Date: Tue, 19 Jun 2007 11:23:12 +0000 (+0000) Subject: Return usernames correctly. X-Git-Tag: live~8909 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/7ab154a0ae8b6a1e105212f0f37a688bf6d94c8a Return usernames correctly. --- diff --git a/app/models/node.rb b/app/models/node.rb index 6eecc853d..abf0c583e 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -84,15 +84,17 @@ class Node < ActiveRecord::Base el1['lat'] = self.latitude.to_s el1['lon'] = self.longitude.to_s - # el['user'] = self.user.display_name if self.user.data_public? user_display_name_cache = {} if user_display_name_cache.nil? + if user_display_name_cache and user_display_name_cache[self.user_id] # use the cache if available - else + elsif self.user.data_public? user_display_name_cache[self.user_id] = self.user.display_name + else + user_display_name_cache[self.user_id] = nil end - el1['user'] = user_display_name_cache[self.user_id] + el1['user'] = user_display_name_cache[self.user_id] unless user_display_name_cache[self.user_id].nil? Node.split_tags(el1, self.tags) el1['visible'] = self.visible.to_s diff --git a/app/models/segment.rb b/app/models/segment.rb index 14949879d..246570b46 100644 --- a/app/models/segment.rb +++ b/app/models/segment.rb @@ -80,14 +80,16 @@ class Segment < ActiveRecord::Base el1['to'] = self.node_b.to_s user_display_name_cache = {} if user_display_name_cache.nil? + if user_display_name_cache and user_display_name_cache[self.user_id] # use the cache if available - else + elsif self.user.data_public? user_display_name_cache[self.user_id] = self.user.display_name + else + user_display_name_cache[self.user_id] = nil end - - #el1['user'] = self.user.display_name if self.user.data_public? - el1['user'] = user_display_name_cache[self.user_id] + + el1['user'] = user_display_name_cache[self.user_id] unless user_display_name_cache[self.user_id].nil? Segment.split_tags(el1, self.tags) el1['visible'] = self.visible.to_s diff --git a/app/models/way.rb b/app/models/way.rb index 090c7a739..d5d2dc98e 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -60,12 +60,13 @@ class Way < ActiveRecord::Base if user_display_name_cache and user_display_name_cache[self.user_id] # use the cache if available - else + elsif self.user.data_public? user_display_name_cache[self.user_id] = self.user.display_name + else + user_display_name_cache[self.user_id] = nil end - - #el1['user'] = self.user.display_name if self.user.data_public? - el1['user'] = user_display_name_cache[self.user_id] + + el1['user'] = user_display_name_cache[self.user_id] unless user_display_name_cache[self.user_id].nil? # make sure segments are output in sequence_id order ordered_segments = []