Return the "large" image from the user details API call
authorTom Hughes <tom@compton.nu>
Mon, 9 Jul 2018 19:26:37 +0000 (20:26 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 9 Jul 2018 19:26:37 +0000 (20:26 +0100)
Closes #1923

app/helpers/user_helper.rb
app/views/user/api_read.builder
test/helpers/user_helper_test.rb

index 27d6faa..065a562 100644 (file)
@@ -38,7 +38,7 @@ module UserHelper
     if user.image_use_gravatar
       user_gravatar_url(user, options)
     else
-      image_url(user.image.url)
+      image_url(user.image.url(:large))
     end
   end
 
index 4ed8c9e..e9cebd5 100644 (file)
@@ -10,7 +10,7 @@ xml.osm("version" => API_VERSION, "generator" => GENERATOR) do
     else
       xml.tag! "contributor-terms", :agreed => @user.terms_agreed.present?
     end
-    xml.tag! "img", :href => user_image_url(@user, :size => 256) if @user.image.file? || @user.image_use_gravatar
+    xml.tag! "img", :href => user_image_url(@user) if @user.image.file? || @user.image_use_gravatar
     xml.tag! "roles" do
       @user.roles.each do |role|
         xml.tag! role.role
index eedc877..c57299a 100644 (file)
@@ -59,7 +59,7 @@ class UserHelperTest < ActionView::TestCase
     gravatar_user = create(:user, :image_use_gravatar => true)
 
     url = user_image_url(user)
-    assert_match %r{^/attachments/users/images/\d{3}/\d{3}/\d{3}/original/d41d8cd98f00b204e9800998ecf8427e.jpg$}, url
+    assert_match %r{^/attachments/users/images/\d{3}/\d{3}/\d{3}/large/d41d8cd98f00b204e9800998ecf8427e.jpg$}, url
 
     url = user_image_url(gravatar_user)
     assert_match %r{^http://www.gravatar.com/avatar/}, url