Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c62d9388
Commit
c62d9388
authored
Apr 06, 2021
by
Robert May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable avatar cache feature
Removes the avatar_cache_for_email feature flag.
parent
3d93021f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
57 deletions
+15
-57
app/helpers/avatars_helper.rb
app/helpers/avatars_helper.rb
+1
-5
app/models/concerns/avatarable.rb
app/models/concerns/avatarable.rb
+0
-1
changelogs/unreleased/remove-avatar-cache-ff.yml
changelogs/unreleased/remove-avatar-cache-ff.yml
+5
-0
config/feature_flags/development/avatar_cache_for_email.yml
config/feature_flags/development/avatar_cache_for_email.yml
+0
-8
spec/helpers/avatars_helper_spec.rb
spec/helpers/avatars_helper_spec.rb
+5
-19
spec/models/user_spec.rb
spec/models/user_spec.rb
+4
-24
No files found.
app/helpers/avatars_helper.rb
View file @
c62d9388
...
...
@@ -24,13 +24,9 @@ module AvatarsHelper
def
avatar_icon_for_email
(
email
=
nil
,
size
=
nil
,
scale
=
2
,
only_path:
true
)
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
avatar_icon_by_user_email_or_gravatar
(
email
,
size
,
scale
,
only_path:
only_path
)
end
else
avatar_icon_by_user_email_or_gravatar
(
email
,
size
,
scale
,
only_path:
only_path
)
end
end
def
avatar_icon_for_user
(
user
=
nil
,
size
=
nil
,
scale
=
2
,
only_path:
true
)
...
...
app/models/concerns/avatarable.rb
View file @
c62d9388
...
...
@@ -131,7 +131,6 @@ module Avatarable
def
clear_avatar_caches
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
)
end
...
...
changelogs/unreleased/remove-avatar-cache-ff.yml
0 → 100644
View file @
c62d9388
---
title
:
Enable cached avatar lookups by email
merge_request
:
58659
author
:
type
:
performance
config/feature_flags/development/avatar_cache_for_email.yml
deleted
100644 → 0
View file @
3d93021f
---
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
spec/helpers/avatars_helper_spec.rb
View file @
c62d9388
...
...
@@ -121,11 +121,6 @@ RSpec.describe AvatarsHelper do
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
"caches the request"
do
...
...
@@ -136,15 +131,6 @@ RSpec.describe AvatarsHelper do
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
let
(
:user
)
{
create
(
:user
,
avatar:
File
.
open
(
uploaded_image_temp_path
))
}
...
...
spec/models/user_spec.rb
View file @
c62d9388
...
...
@@ -2521,11 +2521,6 @@ RSpec.describe User do
describe
"#clear_avatar_caches"
do
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
allow
(
user
).
to
receive
(
:avatar_changed?
).
and_return
(
true
)
...
...
@@ -2535,21 +2530,6 @@ RSpec.describe User do
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
let
(
:user
)
{
create
(
:user
,
email:
'user@email.com'
)
}
let!
(
:project_member_invite
)
{
create
(
:project_member
,
:invited
,
invite_email:
user
.
email
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment