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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
6639aa3f
Commit
6639aa3f
authored
Sep 06, 2019
by
Lee Tickett
Committed by
Douglas Barbosa Alexandre
Sep 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only show `/copy_metadata` when usable
parent
af0eb56e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
changelogs/unreleased/31735-only-show-copy_metadata-when-usable.yml
.../unreleased/31735-only-show-copy_metadata-when-usable.yml
+5
-0
lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
+1
-1
spec/services/quick_actions/interpret_service_spec.rb
spec/services/quick_actions/interpret_service_spec.rb
+13
-0
No files found.
changelogs/unreleased/31735-only-show-copy_metadata-when-usable.yml
0 → 100644
View file @
6639aa3f
---
title
:
Only show /copy_metadata quick action when usable
merge_request
:
31735
author
:
Lee Tickett
type
:
fixed
lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
View file @
6639aa3f
...
...
@@ -122,7 +122,7 @@ module Gitlab
params
'#issue | !merge_request'
types
Issue
,
MergeRequest
condition
do
current_user
.
can?
(
:"
update
_
#{
quick_action_target
.
to_ability_name
}
"
,
quick_action_target
)
current_user
.
can?
(
:"
admin
_
#{
quick_action_target
.
to_ability_name
}
"
,
quick_action_target
)
end
parse_params
do
|
issuable_param
|
extract_references
(
issuable_param
,
:issue
).
first
||
...
...
spec/services/quick_actions/interpret_service_spec.rb
View file @
6639aa3f
...
...
@@ -1140,6 +1140,19 @@ describe QuickActions::InterpretService do
let
(
:todo_label
)
{
create
(
:label
,
project:
project
,
title:
'To Do'
)
}
let
(
:inreview_label
)
{
create
(
:label
,
project:
project
,
title:
'In Review'
)
}
it
'is available when the user is a developer'
do
expect
(
service
.
available_commands
(
issue
)).
to
include
(
a_hash_including
(
name: :copy_metadata
))
end
context
'when the user does not have permission'
do
let
(
:guest
)
{
create
(
:user
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
guest
)
}
it
'is not available'
do
expect
(
service
.
available_commands
(
issue
)).
not_to
include
(
a_hash_including
(
name: :copy_metadata
))
end
end
it_behaves_like
'empty command'
do
let
(
:content
)
{
'/copy_metadata'
}
let
(
:issuable
)
{
issue
}
...
...
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