diff options
author | Stan Hu <stanhu@gmail.com> | 2018-09-04 21:57:13 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-09-04 22:20:58 +0300 |
commit | d4bdcfbf19b594646d597bae5eb6d0c0f7354362 (patch) | |
tree | f2e29f5c4b60128ffacd8103ef2867eeefc9b544 /app/models/concerns/avatarable.rb | |
parent | 8ff02cf7c43b7f7a2f5ca46aa678cfce67eab39b (diff) |
Disable project avatar validation if avatar has not changed
Every time a column in the projects table is changed, the Avatarable concern
would validate that the avatar file size was under 200K. This not only delays
the database changes, but it also can lead to unrelated failures if the HTTP
request fails for some reason.
Closes #51053
Diffstat (limited to 'app/models/concerns/avatarable.rb')
-rw-r--r-- | app/models/concerns/avatarable.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/concerns/avatarable.rb b/app/models/concerns/avatarable.rb index c0233661a9b..0d5311a9985 100644 --- a/app/models/concerns/avatarable.rb +++ b/app/models/concerns/avatarable.rb @@ -9,7 +9,7 @@ module Avatarable include Gitlab::Utils::StrongMemoize validate :avatar_type, if: ->(user) { user.avatar.present? && user.avatar_changed? } - validates :avatar, file_size: { maximum: 200.kilobytes.to_i } + validates :avatar, file_size: { maximum: 200.kilobytes.to_i }, if: :avatar_changed? mount_uploader :avatar, AvatarUploader |