Project

General

Profile

Feature #44509 » 0001-Dim-avatars-of-inactive-users-so-that-locked-users-c.patch

Go MAEDA, 2026-09-26 11:06

View differences:

app/assets/stylesheets/application.css
2380 2380
  vertical-align: middle;
2381 2381
  flex-shrink: 0;
2382 2382
}
2383
.avatar.inactive {opacity: .6;}
2383 2384
span[role="img"].avatar {
2384 2385
  font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
app/helpers/avatars_helper.rb
39 39
  def avatar(user, options = {})
40 40
    # "avatar" class should be added to all avatars
41 41
    options[:class] = ['avatar', options[:class]].compact.join(' ')
42
    # Dim avatars of locked or registered users
43
    options[:class] += ' inactive' if user.is_a?(User) && user.logged? && !user.active?
42 44
    if user.is_a?(AnonymousUser)
43 45
      anonymous_avatar(options)
test/helpers/avatars_helper_test.rb
92 92
    end
93 93
  end
94
  def test_avatar_with_inactive_user_should_have_inactive_class
95
    user = User.find(5)
96
    assert user.locked?
97
    assert_include 'class="gravatar avatar inactive"', avatar(user)
98
    with_settings :gravatar_enabled => '0' do
99
      assert_equal "<span role=\"img\" class=\"avatar-color-5 s24 avatar inactive\">DL</span>", avatar(user)
100
    end
101

  
102
    user.status = User::STATUS_REGISTERED
103
    assert_include 'class="gravatar avatar inactive"', avatar(user)
104
  end
105

  
94 106
  def test_avatar_server_url
95 107
    to_test = {
96 108
      'https://www.gravatar.com' => %r|https://www.gravatar.com/avatar/\h{32}|,
(5-5/5)