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
30dfef5d
Commit
30dfef5d
authored
May 15, 2020
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[GQL] All merge request permissions need gitaly
This dries up the code a little.
parent
a81bba38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
app/graphql/types/permission_types/merge_request.rb
app/graphql/types/permission_types/merge_request.rb
+8
-4
No files found.
app/graphql/types/permission_types/merge_request.rb
View file @
30dfef5d
...
...
@@ -3,6 +3,11 @@
module
Types
module
PermissionTypes
class
MergeRequest
<
BasePermissionType
PERMISSION_FIELDS
=
%i[push_to_source_branch
remove_source_branch
cherry_pick_on_current_merge_request
revert_on_current_merge_request]
.
freeze
present_using
MergeRequestPresenter
description
'Check permissions for the current user on a merge request'
graphql_name
'MergeRequestPermissions'
...
...
@@ -10,10 +15,9 @@ module Types
abilities
:read_merge_request
,
:admin_merge_request
,
:update_merge_request
,
:create_note
permission_field
:push_to_source_branch
,
method: :can_push_to_source_branch?
,
calls_gitaly:
true
permission_field
:remove_source_branch
,
method: :can_remove_source_branch?
,
calls_gitaly:
true
permission_field
:cherry_pick_on_current_merge_request
,
method: :can_cherry_pick_on_current_merge_request?
permission_field
:revert_on_current_merge_request
,
method: :can_revert_on_current_merge_request?
PERMISSION_FIELDS
.
each
do
|
field_name
|
permission_field
field_name
,
method: :"can_
#{
field_name
}
?"
,
calls_gitaly:
true
end
end
end
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