diff options
Diffstat (limited to 'app/models/concerns/avatarable.rb')
-rw-r--r-- | app/models/concerns/avatarable.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/concerns/avatarable.rb b/app/models/concerns/avatarable.rb index d342b526677..c106c08c04a 100644 --- a/app/models/concerns/avatarable.rb +++ b/app/models/concerns/avatarable.rb @@ -20,6 +20,7 @@ module Avatarable mount_uploader :avatar, AvatarUploader after_initialize :add_avatar_to_batch + after_commit :clear_avatar_caches end module ShadowMethods @@ -127,4 +128,11 @@ module Avatarable def avatar_mounter strong_memoize(:avatar_mounter) { _mounter(:avatar) } end + + 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 end |