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
737901db
Commit
737901db
authored
Aug 26, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide `/epic` and `/remove_epic` for unsupported issuables
For example, incidents cannot be linked to epics.
parent
7e0e3508
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
2 deletions
+53
-2
ee/lib/ee/gitlab/quick_actions/issue_actions.rb
ee/lib/ee/gitlab/quick_actions/issue_actions.rb
+3
-1
ee/spec/services/ee/notes/quick_actions_service_spec.rb
ee/spec/services/ee/notes/quick_actions_service_spec.rb
+24
-0
ee/spec/services/quick_actions/interpret_service_spec.rb
ee/spec/services/quick_actions/interpret_service_spec.rb
+26
-1
No files found.
ee/lib/ee/gitlab/quick_actions/issue_actions.rb
View file @
737901db
...
...
@@ -12,7 +12,8 @@ module EE
explanation
_
(
'Adds an issue to an epic.'
)
types
Issue
condition
do
quick_action_target
.
project
.
group
&
.
feature_available?
(
:epics
)
&&
quick_action_target
.
supports_epic?
&&
quick_action_target
.
project
.
group
&
.
feature_available?
(
:epics
)
&&
current_user
.
can?
(
:"admin_
#{
quick_action_target
.
to_ability_name
}
"
,
quick_action_target
)
end
params
'<&epic | group&epic | Epic URL>'
...
...
@@ -42,6 +43,7 @@ module EE
types
Issue
condition
do
quick_action_target
.
persisted?
&&
quick_action_target
.
supports_epic?
&&
quick_action_target
.
project
.
group
&
.
feature_available?
(
:epics
)
&&
current_user
.
can?
(
:"admin_
#{
quick_action_target
.
to_ability_name
}
"
,
quick_action_target
)
end
...
...
ee/spec/services/ee/notes/quick_actions_service_spec.rb
View file @
737901db
...
...
@@ -52,6 +52,20 @@ RSpec.describe Notes::QuickActionsService do
end
end
context
'on an incident'
do
before
do
issue
.
update!
(
issue_type: :incident
)
end
it
'leaves the note empty'
do
expect
(
execute
(
note
)).
to
be_empty
end
it
'does not assigns the issue to the epic'
do
expect
{
execute
(
note
)
}.
not_to
change
{
issue
.
reload
.
epic
}
end
end
context
'on a merge request'
do
let
(
:note_mr
)
{
create
(
:note_on_merge_request
,
project:
project
,
note:
note_text
)
}
...
...
@@ -97,6 +111,16 @@ RSpec.describe Notes::QuickActionsService do
end
end
context
'on an incident'
do
before
do
issue
.
update!
(
issue_type: :incident
)
end
it
'leaves the note empty'
do
expect
(
execute
(
note
)).
to
be_empty
end
end
context
'on a merge request'
do
let
(
:note_mr
)
{
create
(
:note_on_merge_request
,
project:
project
,
note:
note_text
)
}
...
...
ee/spec/services/quick_actions/interpret_service_spec.rb
View file @
737901db
...
...
@@ -362,6 +362,16 @@ RSpec.describe QuickActions::InterpretService do
expect
(
message
).
to
eq
(
"Issue
#{
issue
.
to_reference
}
has already been added to epic
#{
epic
.
to_reference
}
."
)
end
end
context
'when issuable does not support epics'
do
it
'does not assign an incident to an epic'
do
incident
=
create
(
:incident
,
project:
project
)
_
,
updates
=
service
.
execute
(
content
,
incident
)
expect
(
updates
).
to
be_empty
end
end
end
context
'when epic does not exist'
do
...
...
@@ -720,13 +730,18 @@ RSpec.describe QuickActions::InterpretService do
context
'remove_epic command'
do
let
(
:epic
)
{
create
(
:epic
,
group:
group
)
}
let
(
:content
)
{
"/remove_epic
#{
epic
.
to_reference
(
project
)
}
"
}
let
(
:content
)
{
"/remove_epic"
}
before
do
stub_licensed_features
(
epics:
true
)
issue
.
update!
(
epic:
epic
)
end
context
'when epics are disabled'
do
before
do
stub_licensed_features
(
epics:
false
)
end
it
'does not recognize /remove_epic'
do
_
,
updates
=
service
.
execute
(
content
,
issue
)
...
...
@@ -745,6 +760,16 @@ RSpec.describe QuickActions::InterpretService do
expect
(
updates
).
to
eq
(
epic:
nil
)
end
end
context
'when issuable does not support epics'
do
it
'does not recognize /remove_epic'
do
incident
=
create
(
:incident
,
project:
project
,
epic:
epic
)
_
,
updates
=
service
.
execute
(
content
,
incident
)
expect
(
updates
).
to
be_empty
end
end
end
context
'approve command'
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