]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/api/users/_user.json.jbuilder
Merge remote-tracking branch 'upstream/pull/3778'
[rails.git] / app / views / api / users / _user.json.jbuilder
index d89b42befcf8a8725e6332945d060cb5e6001034..15f0685ac9e24b9131b75ab2389a73c04157e008 100644 (file)
@@ -1,10 +1,10 @@
 json.user do
   json.id user.id
   json.display_name user.display_name
 json.user do
   json.id user.id
   json.display_name user.display_name
-  json.account_created user.creation_time.xmlschema
+  json.account_created user.created_at.xmlschema
   json.description user.description if user.description
 
   json.description user.description if user.description
 
-  if current_user && current_user == user
+  if current_user && current_user == user && can?(:details, User)
     json.contributor_terms do
       json.agreed user.terms_agreed.present?
       json.pd user.consider_pd
     json.contributor_terms do
       json.agreed user.terms_agreed.present?
       json.pd user.consider_pd
@@ -45,7 +45,7 @@ json.user do
     end
   end
 
     end
   end
 
-  if current_user && current_user == user
+  if current_user && current_user == user && can?(:details, User)
     if user.home_lat && user.home_lon
       json.home do
         json.lat user.home_lat
     if user.home_lat && user.home_lon
       json.home do
         json.lat user.home_lat
@@ -65,5 +65,7 @@ json.user do
         json.count user.sent_messages.size
       end
     end
         json.count user.sent_messages.size
       end
     end
+
+    json.email user.email if scope_enabled?(:read_email)
   end
 end
   end
 end