From 896f5bb01172f90de83c7b470af53729ed0d4ad1 Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Sat, 26 Sep 2026 17:01:19 +0900 Subject: [PATCH] Dim avatars of inactive users so that locked users can be distinguished at a glance --- app/assets/stylesheets/application.css | 1 + app/helpers/avatars_helper.rb | 2 ++ test/helpers/avatars_helper_test.rb | 12 ++++++++++++ 3 files changed, 15 insertions(+) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 7b6f6d863..05a828f99 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -2380,6 +2380,7 @@ img.filecontent.image {background-image: url(/transparent.png);} vertical-align: middle; flex-shrink: 0; } +.avatar.inactive {opacity: .6;} span[role="img"].avatar { font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif; diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index c9aea637e..9fc1e754e 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -39,6 +39,8 @@ module AvatarsHelper def avatar(user, options = {}) # "avatar" class should be added to all avatars options[:class] = ['avatar', options[:class]].compact.join(' ') + # Dim avatars of locked or registered users + options[:class] += ' inactive' if user.is_a?(User) && user.logged? && !user.active? if user.is_a?(AnonymousUser) anonymous_avatar(options) diff --git a/test/helpers/avatars_helper_test.rb b/test/helpers/avatars_helper_test.rb index a27d2b08d..ca70518ed 100644 --- a/test/helpers/avatars_helper_test.rb +++ b/test/helpers/avatars_helper_test.rb @@ -92,6 +92,18 @@ class AvatarsHelperTest < Redmine::HelperTest end end + def test_avatar_with_inactive_user_should_have_inactive_class + user = User.find(5) + assert user.locked? + assert_include 'class="gravatar avatar inactive"', avatar(user) + with_settings :gravatar_enabled => '0' do + assert_equal "DL", avatar(user) + end + + user.status = User::STATUS_REGISTERED + assert_include 'class="gravatar avatar inactive"', avatar(user) + end + def test_avatar_server_url to_test = { 'https://www.gravatar.com' => %r|https://www.gravatar.com/avatar/\h{32}|, -- 2.55.0