Commit c62d9388 authored by Robert May's avatar Robert May

Enable avatar cache feature

Removes the avatar_cache_for_email feature flag.
parent 3d93021f
...@@ -24,13 +24,9 @@ module AvatarsHelper ...@@ -24,13 +24,9 @@ module AvatarsHelper
def avatar_icon_for_email(email = nil, size = nil, scale = 2, only_path: true) def avatar_icon_for_email(email = nil, size = nil, scale = 2, only_path: true)
return gravatar_icon(email, size, scale) if email.nil? return gravatar_icon(email, size, scale) if email.nil?
if Feature.enabled?(:avatar_cache_for_email, @current_user, type: :development)
Gitlab::AvatarCache.by_email(email, size, scale, only_path) do Gitlab::AvatarCache.by_email(email, size, scale, only_path) do
avatar_icon_by_user_email_or_gravatar(email, size, scale, only_path: only_path) avatar_icon_by_user_email_or_gravatar(email, size, scale, only_path: only_path)
end end
else
avatar_icon_by_user_email_or_gravatar(email, size, scale, only_path: only_path)
end
end end
def avatar_icon_for_user(user = nil, size = nil, scale = 2, only_path: true) def avatar_icon_for_user(user = nil, size = nil, scale = 2, only_path: true)
......
...@@ -131,7 +131,6 @@ module Avatarable ...@@ -131,7 +131,6 @@ module Avatarable
def clear_avatar_caches def clear_avatar_caches
return unless respond_to?(:verified_emails) && verified_emails.any? && avatar_changed? return unless respond_to?(:verified_emails) && verified_emails.any? && avatar_changed?
return unless Feature.enabled?(:avatar_cache_for_email, self, type: :development)
Gitlab::AvatarCache.delete_by_email(*verified_emails) Gitlab::AvatarCache.delete_by_email(*verified_emails)
end end
......
---
title: Enable cached avatar lookups by email
merge_request: 58659
author:
type: performance
---
name: avatar_cache_for_email
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55184
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/323185
milestone: '13.10'
type: development
group: group::source code
default_enabled: false
...@@ -121,11 +121,6 @@ RSpec.describe AvatarsHelper do ...@@ -121,11 +121,6 @@ RSpec.describe AvatarsHelper do
end end
end end
context "when :avatar_cache_for_email flag is enabled" do
before do
stub_feature_flags(avatar_cache_for_email: true)
end
it_behaves_like "returns avatar for email" it_behaves_like "returns avatar for email"
it "caches the request" do it "caches the request" do
...@@ -136,15 +131,6 @@ RSpec.describe AvatarsHelper do ...@@ -136,15 +131,6 @@ RSpec.describe AvatarsHelper do
end end
end end
context "when :avatar_cache_for_email flag is disabled" do
before do
stub_feature_flags(avatar_cache_for_email: false)
end
it_behaves_like "returns avatar for email"
end
end
describe '#avatar_icon_for_user' do describe '#avatar_icon_for_user' do
let(:user) { create(:user, avatar: File.open(uploaded_image_temp_path)) } let(:user) { create(:user, avatar: File.open(uploaded_image_temp_path)) }
......
...@@ -2521,11 +2521,6 @@ RSpec.describe User do ...@@ -2521,11 +2521,6 @@ RSpec.describe User do
describe "#clear_avatar_caches" do describe "#clear_avatar_caches" do
let(:user) { create(:user) } let(:user) { create(:user) }
context "when :avatar_cache_for_email flag is enabled" do
before do
stub_feature_flags(avatar_cache_for_email: true)
end
it "clears the avatar cache when saving" do it "clears the avatar cache when saving" do
allow(user).to receive(:avatar_changed?).and_return(true) allow(user).to receive(:avatar_changed?).and_return(true)
...@@ -2535,21 +2530,6 @@ RSpec.describe User do ...@@ -2535,21 +2530,6 @@ RSpec.describe User do
end end
end end
context "when :avatar_cache_for_email flag is disabled" do
before do
stub_feature_flags(avatar_cache_for_email: false)
end
it "doesn't attempt to clear the avatar cache" do
allow(user).to receive(:avatar_changed?).and_return(true)
expect(Gitlab::AvatarCache).not_to receive(:delete_by_email)
user.update(avatar: fixture_file_upload('spec/fixtures/dk.png'))
end
end
end
describe '#accept_pending_invitations!' do describe '#accept_pending_invitations!' do
let(:user) { create(:user, email: 'user@email.com') } let(:user) { create(:user, email: 'user@email.com') }
let!(:project_member_invite) { create(:project_member, :invited, invite_email: user.email) } let!(:project_member_invite) { create(:project_member, :invited, invite_email: user.email) }
......
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