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
36359350
Commit
36359350
authored
Feb 05, 2020
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept epic_id param in IssuesController
parent
87cdcfa4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
ee/app/controllers/ee/projects/issues_controller.rb
ee/app/controllers/ee/projects/issues_controller.rb
+1
-0
ee/spec/controllers/projects/issues_controller_spec.rb
ee/spec/controllers/projects/issues_controller_spec.rb
+15
-11
No files found.
ee/app/controllers/ee/projects/issues_controller.rb
View file @
36359350
...
...
@@ -47,6 +47,7 @@ module EE
def
issue_params_attributes
attrs
=
super
attrs
.
unshift
(
:weight
)
if
project
.
feature_available?
(
:issue_weights
)
attrs
.
unshift
(
:epic_id
)
if
project
.
group
&
.
feature_available?
(
:epics
)
attrs
end
...
...
ee/spec/controllers/projects/issues_controller_spec.rb
View file @
36359350
...
...
@@ -81,15 +81,16 @@ describe Projects::IssuesController do
end
end
describe
'
issue weight
s'
do
let
(
:project
)
{
create
(
:project
)
}
describe
'
licensed feature
s'
do
let
(
:project
)
{
create
(
:project
,
group:
namespace
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:epic
)
{
create
(
:epic
,
group:
namespace
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
weight:
5
)
}
let
(
:issue2
)
{
create
(
:issue
,
project:
project
,
weight:
1
)
}
let
(
:new_issue
)
{
build
(
:issue
,
project:
project
,
weight:
5
)
}
before
do
project
.
add_developer
(
user
)
namespace
.
add_developer
(
user
)
sign_in
(
user
)
end
...
...
@@ -99,7 +100,7 @@ describe Projects::IssuesController do
context
'licensed'
do
before
do
stub_licensed_features
(
issue_weights:
true
)
stub_licensed_features
(
issue_weights:
true
,
epics:
true
)
end
describe
'#index'
do
...
...
@@ -124,30 +125,32 @@ describe Projects::IssuesController do
end
describe
'#update'
do
it
'sets issue weight'
do
perform
:put
,
:update
,
id:
issue
.
to_param
,
issue:
{
weight:
6
},
format: :json
it
'sets issue weight
and epic
'
do
perform
:put
,
:update
,
id:
issue
.
to_param
,
issue:
{
weight:
6
,
epic_id:
epic
.
id
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
issue
.
reload
.
weight
).
to
eq
(
6
)
expect
(
issue
.
epic
).
to
eq
(
epic
)
end
end
describe
'#create'
do
it
'sets issue weight'
do
perform
:post
,
:create
,
issue:
new_issue
.
attributes
it
'sets issue weight
and epic
'
do
perform
:post
,
:create
,
issue:
new_issue
.
attributes
.
merge
(
epic_id:
epic
.
id
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
Issue
.
count
).
to
eq
(
1
)
issue
=
Issue
.
first
expect
(
issue
.
weight
).
to
eq
(
new_issue
.
weight
)
expect
(
issue
.
epic
).
to
eq
(
epic
)
end
end
end
context
'unlicensed'
do
before
do
stub_licensed_features
(
issue_weights:
false
)
stub_licensed_features
(
issue_weights:
false
,
epics:
false
)
end
describe
'#index'
do
...
...
@@ -172,14 +175,15 @@ describe Projects::IssuesController do
end
describe
'#create'
do
it
'does not set issue weight'
do
it
'does not set issue weight
ane epic
'
do
perform
:post
,
:create
,
issue:
new_issue
.
attributes
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
Issue
.
count
).
to
eq
(
1
)
issue
=
Issue
.
first
expect
(
issue
.
read_attribute
(
:weight
)).
to
be_nil
expect
(
issue
.
weight
).
to
be_nil
expect
(
issue
.
epic
).
to
be_nil
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