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
9459111a
Commit
9459111a
authored
Sep 04, 2020
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure epic_id param is handled properly
parent
39290fed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
ee/app/services/ee/issues/base_service.rb
ee/app/services/ee/issues/base_service.rb
+3
-3
ee/spec/support/shared_examples/services/issue_epic_shared_examples.rb
...rt/shared_examples/services/issue_epic_shared_examples.rb
+25
-0
No files found.
ee/app/services/ee/issues/base_service.rb
View file @
9459111a
...
...
@@ -31,7 +31,8 @@ module EE
def
set_epic_param
(
issue
)
return
unless
epic_param_present?
epic
=
epic_param
||
find_epic
(
issue
)
epic_id
=
params
.
delete
(
:epic_id
)
epic
=
epic_param
||
find_epic
(
issue
,
epic_id
)
unless
epic
params
[
:epic
]
=
nil
...
...
@@ -45,8 +46,7 @@ module EE
params
[
:epic
]
=
epic
end
def
find_epic
(
issue
)
epic_id
=
params
.
delete
(
:epic_id
)
def
find_epic
(
issue
,
epic_id
)
return
if
epic_id
.
to_i
==
0
group
=
issue
.
project
.
group
...
...
ee/spec/support/shared_examples/services/issue_epic_shared_examples.rb
View file @
9459111a
...
...
@@ -61,6 +61,31 @@ RSpec.shared_examples 'issue with epic_id parameter' do
end
end
context
'when epic param is also present'
do
context
'when epic_id belongs to another valid epic'
do
let
(
:other_epic
)
{
create
(
:epic
,
group:
group
)
}
let
(
:params
)
{
{
title:
'issue1'
,
epic:
epic
,
epic_id:
other_epic
.
id
}
}
it
'creates epic issue link based on the epic param'
do
issue
=
execute
expect
(
issue
.
reload
).
to
be_persisted
expect
(
issue
.
epic
).
to
eq
(
epic
)
end
end
context
'when epic_id is empty'
do
let
(
:params
)
{
{
title:
'issue1'
,
epic:
epic
,
epic_id:
''
}
}
it
'creates epic issue link based on the epic param'
do
issue
=
execute
expect
(
issue
.
reload
).
to
be_persisted
expect
(
issue
.
epic
).
to
eq
(
epic
)
end
end
end
context
'when a project is from a subgroup of the epic group'
do
before
do
subgroup
=
create
(
:group
,
parent:
group
)
...
...
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