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
e4adf015
Commit
e4adf015
authored
May 15, 2018
by
Jacopo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes 500 error on /estimate BIG_VALUE
parent
3a1843f9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
app/models/concerns/time_trackable.rb
app/models/concerns/time_trackable.rb
+4
-0
changelogs/unreleased/46193-fix-big-estimate.yml
changelogs/unreleased/46193-fix-big-estimate.yml
+5
-0
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+13
-0
No files found.
app/models/concerns/time_trackable.rb
View file @
e4adf015
...
...
@@ -53,6 +53,10 @@ module TimeTrackable
Gitlab
::
TimeTrackingFormatter
.
output
(
time_estimate
)
end
def
time_estimate
=
(
val
)
val
.
is_a?
(
Integer
)
?
super
([
val
,
Gitlab
::
Database
::
MAX_INT_VALUE
].
min
)
:
super
(
val
)
end
private
def
touchable?
...
...
changelogs/unreleased/46193-fix-big-estimate.yml
0 → 100644
View file @
e4adf015
---
title
:
Fixes 500 error on /estimate BIG_VALUE
merge_request
:
18964
author
:
Jacopo Beschi @jacopo-beschi
type
:
fixed
spec/models/concerns/issuable_spec.rb
View file @
e4adf015
...
...
@@ -266,6 +266,19 @@ describe Issuable do
end
end
describe
'#time_estimate='
do
it
'coerces the value below Gitlab::Database::MAX_INT_VALUE'
do
expect
{
issue
.
time_estimate
=
100
}.
to
change
{
issue
.
time_estimate
}.
to
(
100
)
expect
{
issue
.
time_estimate
=
Gitlab
::
Database
::
MAX_INT_VALUE
+
100
}.
to
change
{
issue
.
time_estimate
}.
to
(
Gitlab
::
Database
::
MAX_INT_VALUE
)
end
it
'skips coercion for not Integer values'
do
expect
{
issue
.
time_estimate
=
nil
}.
to
change
{
issue
.
time_estimate
}.
to
(
nil
)
expect
{
issue
.
time_estimate
=
'invalid time'
}.
not_to
raise_error
(
StandardError
)
expect
{
issue
.
time_estimate
=
22.33
}.
not_to
raise_error
(
StandardError
)
end
end
describe
'#to_hook_data'
do
let
(
:builder
)
{
double
}
...
...
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