From 5b424c2499bf3422d4af959b95c036cf71492fcc Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Mon, 19 Oct 2026 23:50:39 +0900 Subject: [PATCH] Set width and height on Gravatar images to avoid layout shifts --- lib/plugins/gravatar/lib/gravatar.rb | 2 +- test/helpers/avatars_helper_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/plugins/gravatar/lib/gravatar.rb b/lib/plugins/gravatar/lib/gravatar.rb index 316a01b19..3647e31f0 100644 --- a/lib/plugins/gravatar/lib/gravatar.rb +++ b/lib/plugins/gravatar/lib/gravatar.rb @@ -54,7 +54,7 @@ module GravatarHelper # double the size for hires displays options[:srcset] = "#{gravatar_url(email, options.merge(size: options[:size].to_i * 2))} 2x" - image_tag src, options.except(:rating, :size, :default, :ssl) + image_tag src, options.except(:rating, :default, :ssl) end # Returns the base Gravatar URL for the given email hash diff --git a/test/helpers/avatars_helper_test.rb b/test/helpers/avatars_helper_test.rb index 98daaa5cc..94fe0398c 100644 --- a/test/helpers/avatars_helper_test.rb +++ b/test/helpers/avatars_helper_test.rb @@ -93,6 +93,7 @@ class AvatarsHelperTest < Redmine::HelperTest def test_avatar_with_size_option assert_include 'size=24', avatar('jsmith ', :size => 24) + assert_include 'width="24" height="24"', avatar('jsmith ', :size => 24) assert_include 'width="24" height="24"', avatar(User.anonymous, :size => 24) end -- 2.55.0