diff options
author | Stan Hu <stanhu@gmail.com> | 2015-05-06 14:33:39 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-05-07 10:00:35 -0700 |
commit | bf4b4384590c271d1dfadf874d185c2f6130ad0e (patch) | |
tree | 8b83f49680900b3d91fbeba28f65c28ed1245dbb /app/models/group.rb | |
parent | 415648e2555e25d30f64f4c2642cf149f6965859 (diff) | |
download | gitlab-ce-bf4b4384590c271d1dfadf874d185c2f6130ad0e.tar.gz |
Fix bug where avatar filenames were not actually deleted from the database during removal.
This would result in a 404 error in certain views.
The `save` call was being rolled back due to an error in the validation step.
Relax the validation step so that this works.
Closes #1570
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index 1386a9eccc9..687458adac4 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -20,7 +20,7 @@ class Group < Namespace has_many :group_members, dependent: :destroy, as: :source, class_name: 'GroupMember' has_many :users, through: :group_members - validate :avatar_type, if: ->(user) { user.avatar_changed? } + validate :avatar_type, if: ->(user) { user.avatar.present? && user.avatar_changed? } validates :avatar, file_size: { maximum: 200.kilobytes.to_i } mount_uploader :avatar, AvatarUploader |