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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f7b24bd1
Commit
f7b24bd1
authored
Oct 10, 2019
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix creating epics with dates from api
- set start_date and end_date if dates are fixed
parent
92c346f6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
1 deletion
+32
-1
changelogs/unreleased/13360-fix-epics-api.yml
changelogs/unreleased/13360-fix-epics-api.yml
+5
-0
ee/app/services/epics/create_service.rb
ee/app/services/epics/create_service.rb
+11
-1
ee/spec/requests/api/epics_spec.rb
ee/spec/requests/api/epics_spec.rb
+1
-0
ee/spec/services/epics/create_service_spec.rb
ee/spec/services/epics/create_service_spec.rb
+15
-0
No files found.
changelogs/unreleased/13360-fix-epics-api.yml
0 → 100644
View file @
f7b24bd1
---
title
:
Fix creating epics with dates from api
merge_request
:
18393
author
:
type
:
fixed
ee/app/services/epics/create_service.rb
View file @
f7b24bd1
...
@@ -20,7 +20,17 @@ module Epics
...
@@ -20,7 +20,17 @@ module Epics
end
end
def
whitelisted_epic_params
def
whitelisted_epic_params
params
.
slice
(
:title
,
:description
,
:start_date
,
:end_date
,
:milestone
,
:label_ids
,
:parent_id
)
result
=
params
.
slice
(
:title
,
:description
,
:label_ids
,
:parent_id
)
if
params
[
:start_date_fixed
]
&&
params
[
:start_date_is_fixed
]
result
[
:start_date
]
=
params
[
:start_date_fixed
]
end
if
params
[
:due_date_fixed
]
&&
params
[
:due_date_is_fixed
]
result
[
:end_date
]
=
params
[
:due_date_fixed
]
end
result
end
end
end
end
end
end
ee/spec/requests/api/epics_spec.rb
View file @
f7b24bd1
...
@@ -491,6 +491,7 @@ describe API::Epics do
...
@@ -491,6 +491,7 @@ describe API::Epics do
expect
(
epic
.
description
).
to
eq
(
'epic description'
)
expect
(
epic
.
description
).
to
eq
(
'epic description'
)
expect
(
epic
.
start_date_fixed
).
to
eq
(
nil
)
expect
(
epic
.
start_date_fixed
).
to
eq
(
nil
)
expect
(
epic
.
start_date_is_fixed
).
to
be_falsey
expect
(
epic
.
start_date_is_fixed
).
to
be_falsey
expect
(
epic
.
due_date
).
to
eq
(
Date
.
new
(
2018
,
7
,
17
))
expect
(
epic
.
due_date_fixed
).
to
eq
(
Date
.
new
(
2018
,
7
,
17
))
expect
(
epic
.
due_date_fixed
).
to
eq
(
Date
.
new
(
2018
,
7
,
17
))
expect
(
epic
.
due_date_is_fixed
).
to
eq
(
true
)
expect
(
epic
.
due_date_is_fixed
).
to
eq
(
true
)
expect
(
epic
.
labels
.
first
.
title
).
to
eq
(
'label1'
)
expect
(
epic
.
labels
.
first
.
title
).
to
eq
(
'label1'
)
...
...
ee/spec/services/epics/create_service_spec.rb
View file @
f7b24bd1
...
@@ -25,4 +25,19 @@ describe Epics::CreateService do
...
@@ -25,4 +25,19 @@ describe Epics::CreateService do
expect
(
NewEpicWorker
).
to
have_received
(
:perform_async
).
with
(
epic
.
id
,
user
.
id
)
expect
(
NewEpicWorker
).
to
have_received
(
:perform_async
).
with
(
epic
.
id
,
user
.
id
)
end
end
end
end
context
'handling fixed dates'
do
it
'sets the fixed date correctly'
do
date
=
Date
.
new
(
2019
,
10
,
10
)
params
[
:start_date_fixed
]
=
date
params
[
:start_date_is_fixed
]
=
true
subject
epic
=
Epic
.
last
expect
(
epic
.
start_date
).
to
eq
(
date
)
expect
(
epic
.
start_date_fixed
).
to
eq
(
date
)
expect
(
epic
.
start_date_is_fixed
).
to
be_truthy
end
end
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