Commit 651ded4a authored by Yogi's avatar Yogi Committed by Igor Drozdov

Remove avatar of the blocked user

When a user is blocked for violating the terms of service on gitlab.com, their profile and history is no longer accessible, but their avatar is still visible.
parent 0dfb80f3
......@@ -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