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
Boxiang Sun
gitlab-ce
Commits
7a123603
Commit
7a123603
authored
Mar 24, 2017
by
Alexander Randa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix projects_limit RangeError on user create
parent
f74e9245
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
2 deletions
+9
-2
app/models/user.rb
app/models/user.rb
+3
-1
app/views/admin/users/_access_levels.html.haml
app/views/admin/users/_access_levels.html.haml
+1
-1
changelogs/unreleased/29116-maxint-error.yml
changelogs/unreleased/29116-maxint-error.yml
+4
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-0
No files found.
app/models/user.rb
View file @
7a123603
...
...
@@ -115,7 +115,9 @@ class User < ActiveRecord::Base
validates
:notification_email
,
email:
true
,
if:
->
(
user
)
{
user
.
notification_email
!=
user
.
email
}
validates
:public_email
,
presence:
true
,
uniqueness:
true
,
email:
true
,
allow_blank:
true
validates
:bio
,
length:
{
maximum:
255
},
allow_blank:
true
validates
:projects_limit
,
presence:
true
,
numericality:
{
greater_than_or_equal_to:
0
}
validates
:projects_limit
,
presence:
true
,
numericality:
{
greater_than_or_equal_to:
0
,
less_than_or_equal_to:
Gitlab
::
Database
::
MAX_INT_VALUE
}
validates
:username
,
namespace:
true
,
presence:
true
,
...
...
app/views/admin/users/_access_levels.html.haml
View file @
7a123603
...
...
@@ -2,7 +2,7 @@
%legend
Access
.form-group
=
f
.
label
:projects_limit
,
class:
'control-label'
.col-sm-10
=
f
.
number_field
:projects_limit
,
min:
0
,
class:
'form-control'
.col-sm-10
=
f
.
number_field
:projects_limit
,
min:
0
,
max:
Gitlab
::
Database
::
MAX_INT_VALUE
,
class:
'form-control'
.form-group
=
f
.
label
:can_create_group
,
class:
'control-label'
...
...
changelogs/unreleased/29116-maxint-error.yml
0 → 100644
View file @
7a123603
---
title
:
Fix projects_limit RangeError on user create
merge_request
:
author
:
Alexander Randa
spec/models/user_spec.rb
View file @
7a123603
...
...
@@ -81,6 +81,7 @@ describe User, models: true do
it
{
is_expected
.
to
validate_numericality_of
(
:projects_limit
)
}
it
{
is_expected
.
to
allow_value
(
0
).
for
(
:projects_limit
)
}
it
{
is_expected
.
not_to
allow_value
(
-
1
).
for
(
:projects_limit
)
}
it
{
is_expected
.
not_to
allow_value
(
Gitlab
::
Database
::
MAX_INT_VALUE
+
1
).
for
(
:projects_limit
)
}
it
{
is_expected
.
to
validate_length_of
(
:bio
).
is_at_most
(
255
)
}
...
...
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