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
a503a456
Commit
a503a456
authored
Aug 03, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow usage of severity quickaction on create
Changelog: changed
parent
a8c5d692
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
lib/gitlab/quick_actions/issuable_actions.rb
lib/gitlab/quick_actions/issuable_actions.rb
+8
-2
spec/services/quick_actions/interpret_service_spec.rb
spec/services/quick_actions/interpret_service_spec.rb
+13
-0
No files found.
lib/gitlab/quick_actions/issuable_actions.rb
View file @
a503a456
...
...
@@ -246,14 +246,20 @@ module Gitlab
params
'1 / S1 / Critical'
types
Issue
condition
do
quick_action_target
.
supports_severity?
!
quick_action_target
.
persisted?
||
quick_action_target
.
supports_severity?
end
parse_params
do
|
severity
|
find_severity
(
severity
)
end
command
:severity
do
|
severity
|
next
unless
quick_action_target
.
supports_severity?
if
severity
::
Issues
::
UpdateService
.
new
(
project:
quick_action_target
.
project
,
current_user:
current_user
,
params:
{
severity:
severity
}).
execute
(
quick_action_target
)
if
quick_action_target
.
persisted?
::
Issues
::
UpdateService
.
new
(
project:
quick_action_target
.
project
,
current_user:
current_user
,
params:
{
severity:
severity
}).
execute
(
quick_action_target
)
else
quick_action_target
.
build_issuable_severity
(
severity:
severity
)
end
@execution_message
[
:severity
]
=
_
(
"Severity updated to %{severity}."
)
%
{
severity:
severity
.
capitalize
}
else
...
...
spec/services/quick_actions/interpret_service_spec.rb
View file @
a503a456
...
...
@@ -2096,6 +2096,19 @@ RSpec.describe QuickActions::InterpretService do
end
end
context
'when quick action is used on creation'
do
let
(
:content
)
{
'/severity s3'
}
let
(
:issuable
)
{
build
(
:incident
,
project:
project
)
}
it_behaves_like
'updates the severity'
,
'medium'
context
'issuable does not support severity'
do
let
(
:issuable
)
{
build
(
:issue
,
project:
project
)
}
it_behaves_like
'failed command'
,
''
end
end
context
'severity given with S format'
do
let
(
:content
)
{
'/severity s3'
}
...
...
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