Feature #44509 » 0001-Dim-avatars-of-inactive-users-so-that-locked-users-c.patch
| app/assets/stylesheets/application.css | ||
|---|---|---|
|
vertical-align: middle;
|
||
|
flex-shrink: 0;
|
||
|
}
|
||
|
.avatar.inactive {opacity: .6;}
|
||
|
span[role="img"].avatar {
|
||
|
font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||
| app/helpers/avatars_helper.rb | ||
|---|---|---|
|
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)
|
||
| test/helpers/avatars_helper_test.rb | ||
|---|---|---|
|
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 "<span role=\"img\" class=\"avatar-color-5 s24 avatar inactive\">DL</span>", 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}|,
|
||