Commit 57eb1ef6 authored by Fabian Schneider's avatar Fabian Schneider Committed by Sean McGivern

Change avatar error message to include allowed file formats

parent 2e8135d0
...@@ -22,7 +22,7 @@ module Avatarable ...@@ -22,7 +22,7 @@ module Avatarable
def avatar_type def avatar_type
unless self.avatar.image? unless self.avatar.image?
self.errors.add :avatar, "only images allowed" errors.add :avatar, "file format is not supported. Please try one of the following supported formats: #{AvatarUploader::IMAGE_EXT.join(', ')}"
end end
end end
......
---
title: Change avatar error message to include allowed file formats
merge_request: 17747
author: Fabian Schneider
type: changed
...@@ -241,7 +241,7 @@ describe Group do ...@@ -241,7 +241,7 @@ describe Group do
it "is false if avatar is html page" do it "is false if avatar is html page" do
group.update_attribute(:avatar, 'uploads/avatar.html') group.update_attribute(:avatar, 'uploads/avatar.html')
expect(group.avatar_type).to eq(["only images allowed"]) expect(group.avatar_type).to eq(["file format is not supported. Please try one of the following supported formats: png, jpg, jpeg, gif, bmp, tiff"])
end end
end end
......
...@@ -1055,7 +1055,7 @@ describe Project do ...@@ -1055,7 +1055,7 @@ describe Project do
it 'is false if avatar is html page' do it 'is false if avatar is html page' do
project.update_attribute(:avatar, 'uploads/avatar.html') project.update_attribute(:avatar, 'uploads/avatar.html')
expect(project.avatar_type).to eq(['only images allowed']) expect(project.avatar_type).to eq(['file format is not supported. Please try one of the following supported formats: png, jpg, jpeg, gif, bmp, tiff'])
end end
end end
......
...@@ -1250,7 +1250,7 @@ describe User do ...@@ -1250,7 +1250,7 @@ describe User do
it 'is false if avatar is html page' do it 'is false if avatar is html page' do
user.update_attribute(:avatar, 'uploads/avatar.html') user.update_attribute(:avatar, 'uploads/avatar.html')
expect(user.avatar_type).to eq(['only images allowed']) expect(user.avatar_type).to eq(['file format is not supported. Please try one of the following supported formats: png, jpg, jpeg, gif, bmp, tiff'])
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment