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
93872da0
Commit
93872da0
authored
Jul 24, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set issue type when creating incident issues
parent
81fb0963
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
7 deletions
+17
-7
app/services/incident_management/incidents/create_service.rb
app/services/incident_management/incidents/create_service.rb
+4
-1
app/services/issues/build_service.rb
app/services/issues/build_service.rb
+1
-1
changelogs/unreleased/229547-adjust-code-which-creates-incident-issues-to-pass-issue_type-inste.yml
...hich-creates-incident-issues-to-pass-issue_type-inste.yml
+5
-0
spec/services/incident_management/incidents/create_service_spec.rb
...ices/incident_management/incidents/create_service_spec.rb
+7
-5
No files found.
app/services/incident_management/incidents/create_service.rb
View file @
93872da0
...
...
@@ -3,6 +3,8 @@
module
IncidentManagement
module
Incidents
class
CreateService
<
BaseService
ISSUE_TYPE
=
'incident'
def
initialize
(
project
,
current_user
,
title
:,
description
:)
super
(
project
,
current_user
)
...
...
@@ -16,7 +18,8 @@ module IncidentManagement
current_user
,
title:
title
,
description:
description
,
label_ids:
[
find_or_create_incident_label
.
id
]
label_ids:
[
find_or_create_incident_label
.
id
],
issue_type:
ISSUE_TYPE
).
execute
return
error
(
issue
.
errors
.
full_messages
.
to_sentence
,
issue
)
unless
issue
.
valid?
...
...
app/services/issues/build_service.rb
View file @
93872da0
...
...
@@ -66,7 +66,7 @@ module Issues
def
whitelisted_issue_params
base_params
=
[
:title
,
:description
,
:confidential
]
admin_params
=
[
:milestone_id
]
admin_params
=
[
:milestone_id
,
:issue_type
]
if
can?
(
current_user
,
:admin_issue
,
project
)
params
.
slice
(
*
(
base_params
+
admin_params
))
...
...
changelogs/unreleased/229547-adjust-code-which-creates-incident-issues-to-pass-issue_type-inste.yml
0 → 100644
View file @
93872da0
---
title
:
Sets issue type for incident issues to incident
merge_request
:
37781
author
:
type
:
added
spec/services/incident_management/incidents/create_service_spec.rb
View file @
93872da0
...
...
@@ -25,11 +25,13 @@ RSpec.describe IncidentManagement::Incidents::CreateService do
it
'created issue has correct attributes'
do
create_incident
expect
(
new_issue
.
title
).
to
eq
(
title
)
expect
(
new_issue
.
description
).
to
eq
(
description
)
expect
(
new_issue
.
author
).
to
eq
(
user
)
expect
(
new_issue
.
labels
.
map
(
&
:title
)).
to
eq
([
label_title
])
aggregate_failures
do
expect
(
new_issue
.
title
).
to
eq
(
title
)
expect
(
new_issue
.
description
).
to
eq
(
description
)
expect
(
new_issue
.
author
).
to
eq
(
user
)
expect
(
new_issue
.
issue_type
).
to
eq
(
'incident'
)
expect
(
new_issue
.
labels
.
map
(
&
:title
)).
to
eq
([
label_title
])
end
end
context
'when incident label does not exists'
do
...
...
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