Commit 056e4ed0 authored by Igor Drozdov's avatar Igor Drozdov

Merge branch '239031-yo-remove-avatar-blocked-user' into 'master'

Remove avatar of the blocked user

See merge request gitlab-org/gitlab!52051
parents 51121e06 651ded4a
......@@ -31,11 +31,10 @@ module AvatarsHelper
end
def avatar_icon_for_user(user = nil, size = nil, scale = 2, only_path: true)
if user
user.avatar_url(size: size, only_path: only_path) || default_avatar
else
gravatar_icon(nil, size, scale)
end
return gravatar_icon(nil, size, scale) unless user
return default_avatar if user.blocked?
user.avatar_url(size: size, only_path: only_path) || default_avatar
end
def gravatar_icon(user_email = '', size = nil, scale = 2)
......
---
title: Remove avatar of the blocked user
merge_request: 52051
author: Yogi (@yo)
type: fixed
......@@ -135,6 +135,15 @@ RSpec.describe AvatarsHelper do
helper.avatar_icon_for_user(nil, 20, 2)
end
end
context 'for a blocked user' do
let(:user) { create(:user, :blocked) }
it 'returns the default avatar' do
expect(helper.avatar_icon_for_user(user).to_s)
.to eq(helper.default_avatar)
end
end
end
describe '#gravatar_icon' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment