Don't report the PD flag in the user API call
authorTom Hughes <tom@compton.nu>
Mon, 24 Sep 2012 17:43:30 +0000 (18:43 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 24 Sep 2012 17:44:12 +0000 (18:44 +0100)
app/views/user/api_read.builder
test/functional/user_controller_test.rb

index d25ff9f64046b2b84cd22629ff2dffbcde36a9a6..db7bcc2b7bf98953f2326d9f810db6f5a552ee1a 100644 (file)
@@ -6,9 +6,12 @@ xml.osm("version" => API_VERSION, "generator" => GENERATOR) do
     if @this_user.description
       xml.tag! "description", @this_user.description
     end
-    xml.tag! "contributor-terms",
-        :agreed => !!@this_user.terms_agreed,
-        :pd => !!@this_user.consider_pd
+    if @user && @user == @this_user
+      xml.tag! "contributor-terms", :agreed => !!@this_user.terms_agreed,
+                                    :pd => !!@this_user.consider_pd
+    else
+      xml.tag! "contributor-terms", :agreed => !!@this_user.terms_agreed
+    end
     if @this_user.image.file?
       xml.tag! "img", :href => "http://#{SERVER_URL}#{@this_user.image.url}"
     end
index afff1b2a848ff5ea6f69f8397eb06219ff0bbb88..606924b35d288fe12af91d31ead2aab2deaae0db 100644 (file)
@@ -531,6 +531,7 @@ class UserControllerTest < ActionController::TestCase
     assert_response :success
 
     # check that we aren't revealing private information
+    assert_select "contributor-terms[pd]", false
     assert_select "home", false
     assert_select "languages", false