summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-03-01 16:03:38 +0000
committerDouwe Maan <douwe@gitlab.com>2016-03-01 16:03:38 +0000
commitad9137a785910e825067182409db040f67f5a63c (patch)
tree9df87ec60213c70ed466e56b2c05896e3c678e0f /app/models
parentacd9881061a3196d1ed869448ea6c321301f9ac7 (diff)
parent58a8d6e9ba783d26ebdc6d79b2c457e2721988e8 (diff)
downloadgitlab-ce-ad9137a785910e825067182409db040f67f5a63c.tar.gz
Merge branch 'rs-avatar-validation' into 'master'
Only validate avatar cropping values when avatar is present AND changed Closes #13905 See merge request !3018
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 2dfef208ee5..3098d49d58a 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -169,7 +169,7 @@ class User < ActiveRecord::Base
validates :avatar_crop_x, :avatar_crop_y, :avatar_crop_size,
numericality: { only_integer: true },
presence: true,
- if: ->(user) { user.avatar? }
+ if: ->(user) { user.avatar? && user.avatar_changed? }
before_validation :generate_password, on: :create
before_validation :restricted_signup_domains, on: :create