]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/api/users/_user.json.jbuilder
Merge remote-tracking branch 'upstream/pull/4144'
[rails.git] / app / views / api / users / _user.json.jbuilder
index 9629e8fa50276a53770f1123023a2b46e1253c02..b8491601055207ac3609b6dcf3ba9c120b27d5f5 100644 (file)
@@ -1,10 +1,10 @@
 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
 
-  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
@@ -45,8 +45,8 @@ json.user do
     end
   end
 
-  if current_user && current_user == user
-    if user.home_lat && user.home_lon
+  if current_user && current_user == user && can?(:details, User)
+    if user.has_home?
       json.home do
         json.lat user.home_lat
         json.lon user.home_lon
@@ -54,11 +54,7 @@ json.user do
       end
     end
 
-    if user.languages
-      json.languages do
-        json.array! user.languages.split(",")
-      end
-    end
+    json.languages user.languages if user.languages?
 
     json.messages do
       json.received do
@@ -69,5 +65,7 @@ json.user do
         json.count user.sent_messages.size
       end
     end
+
+    json.email user.email if scope_enabled?(:read_email)
   end
 end