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
3693be11
Commit
3693be11
authored
Aug 11, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove optional_issue_params method
- move issue_type into whitelisted params
parent
48cfe985
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
11 deletions
+4
-11
app/services/issues/build_service.rb
app/services/issues/build_service.rb
+1
-8
spec/services/issues/build_service_spec.rb
spec/services/issues/build_service_spec.rb
+3
-3
No files found.
app/services/issues/build_service.rb
View file @
3693be11
...
...
@@ -65,7 +65,7 @@ module Issues
private
def
whitelisted_issue_params
base_params
=
[
:title
,
:description
,
:confidential
]
base_params
=
[
:title
,
:description
,
:confidential
,
:issue_type
]
admin_params
=
[
:milestone_id
]
if
can?
(
current_user
,
:admin_issue
,
project
)
...
...
@@ -75,16 +75,9 @@ module Issues
end
end
def
optional_issue_params
optional_params
=
[
:issue_type
]
params
.
slice
(
*
optional_params
).
reject
{
|
_
,
v
|
v
.
nil?
}
end
def
build_issue_params
{
author:
current_user
}.
merge
(
issue_params_with_info_from_discussions
)
.
merge
(
whitelisted_issue_params
)
.
merge
(
optional_issue_params
)
end
end
end
...
...
spec/services/issues/build_service_spec.rb
View file @
3693be11
...
...
@@ -148,15 +148,15 @@ RSpec.describe Issues::BuildService do
expect
(
issue
.
milestone
).
to
be_nil
end
context
'
with optional params
'
do
context
'
setting issue type
'
do
it
'sets the issue_type on the issue'
do
issue
=
build_issue
(
issue_type:
'incident'
)
expect
(
issue
.
issue_type
).
to
eq
(
'incident'
)
end
it
'defaults to issue if issue_type n
il
'
do
issue
=
build_issue
(
issue_type:
nil
)
it
'defaults to issue if issue_type n
ot given
'
do
issue
=
build_issue
expect
(
issue
.
issue_type
).
to
eq
(
'issue'
)
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