Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
839589fd
Commit
839589fd
authored
Mar 11, 2018
by
Fabian Schneider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change avatar error message to include allowed file formats
parent
afd2d381
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
10 deletions
+9
-10
app/models/concerns/avatarable.rb
app/models/concerns/avatarable.rb
+1
-1
app/models/group.rb
app/models/group.rb
+0
-6
changelogs/unreleased/43771-improve-avatar-error-message.yml
changelogs/unreleased/43771-improve-avatar-error-message.yml
+5
-0
spec/models/group_spec.rb
spec/models/group_spec.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-1
No files found.
app/models/concerns/avatarable.rb
View file @
839589fd
...
...
@@ -21,7 +21,7 @@ module Avatarable
def
avatar_type
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
...
...
app/models/group.rb
View file @
839589fd
...
...
@@ -189,12 +189,6 @@ class Group < Namespace
owners
.
include?
(
user
)
&&
owners
.
size
==
1
end
def
avatar_type
unless
self
.
avatar
.
image?
self
.
errors
.
add
:avatar
,
"only images allowed"
end
end
def
post_create_hook
Gitlab
::
AppLogger
.
info
(
"Group
\"
#{
name
}
\"
was created"
)
...
...
changelogs/unreleased/43771-improve-avatar-error-message.yml
0 → 100644
View file @
839589fd
---
title
:
Change avatar error message to include allowed file formats
merge_request
:
17747
author
:
Fabian Schneider
type
:
changed
spec/models/group_spec.rb
View file @
839589fd
...
...
@@ -240,7 +240,7 @@ describe Group do
it
"is false if avatar is html page"
do
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
...
...
spec/models/project_spec.rb
View file @
839589fd
...
...
@@ -922,7 +922,7 @@ describe Project do
it
'is false if avatar is html page'
do
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
...
...
spec/models/user_spec.rb
View file @
839589fd
...
...
@@ -1222,7 +1222,7 @@ describe User do
it
'is false if avatar is html page'
do
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment