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
Jérome Perrin
gitlab-ce
Commits
b803bc7b
Commit
b803bc7b
authored
Sep 22, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement review comments from @DouweM.
parent
cef10ef7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
14 deletions
+19
-14
app/models/concerns/protected_branch_access.rb
app/models/concerns/protected_branch_access.rb
+2
-2
app/services/protected_branches/api_create_service.rb
app/services/protected_branches/api_create_service.rb
+15
-10
lib/api/branches.rb
lib/api/branches.rb
+2
-2
No files found.
app/models/concerns/protected_branch_access.rb
View file @
b803bc7b
...
@@ -2,8 +2,8 @@ module ProtectedBranchAccess
...
@@ -2,8 +2,8 @@ module ProtectedBranchAccess
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
included
do
included
do
scope
:master
,
->
()
{
where
(
access_level:
Gitlab
::
Access
::
MASTER
)
}
scope
:master
,
->
{
where
(
access_level:
Gitlab
::
Access
::
MASTER
)
}
scope
:developer
,
->
()
{
where
(
access_level:
Gitlab
::
Access
::
DEVELOPER
)
}
scope
:developer
,
->
{
where
(
access_level:
Gitlab
::
Access
::
DEVELOPER
)
}
end
end
def
humanize
def
humanize
...
...
app/services/protected_branches/api_create_service.rb
View file @
b803bc7b
...
@@ -11,17 +11,22 @@ module ProtectedBranches
...
@@ -11,17 +11,22 @@ module ProtectedBranches
end
end
def
execute
def
execute
if
@developers_can_push
push_access_level
=
@params
.
merge!
(
push_access_levels_attributes:
[{
access_level:
Gitlab
::
Access
::
DEVELOPER
}])
if
@developers_can_push
else
Gitlab
::
Access
::
DEVELOPER
@params
.
merge!
(
push_access_levels_attributes:
[{
access_level:
Gitlab
::
Access
::
MASTER
}])
else
end
Gitlab
::
Access
::
MASTER
end
if
@developers_can_merge
merge_access_level
=
@params
.
merge!
(
merge_access_levels_attributes:
[{
access_level:
Gitlab
::
Access
::
DEVELOPER
}])
if
@developers_can_merge
else
Gitlab
::
Access
::
DEVELOPER
@params
.
merge!
(
merge_access_levels_attributes:
[{
access_level:
Gitlab
::
Access
::
MASTER
}])
else
end
Gitlab
::
Access
::
MASTER
end
@params
.
merge!
(
push_access_levels_attributes:
[{
access_level:
push_access_level
}],
merge_access_levels_attributes:
[{
access_level:
merge_access_level
}])
service
=
ProtectedBranches
::
CreateService
.
new
(
@project
,
@current_user
,
@params
)
service
=
ProtectedBranches
::
CreateService
.
new
(
@project
,
@current_user
,
@params
)
service
.
execute
service
.
execute
...
...
lib/api/branches.rb
View file @
b803bc7b
...
@@ -57,11 +57,11 @@ module API
...
@@ -57,11 +57,11 @@ module API
developers_can_merge
=
to_boolean
(
params
[
:developers_can_merge
])
developers_can_merge
=
to_boolean
(
params
[
:developers_can_merge
])
developers_can_push
=
to_boolean
(
params
[
:developers_can_push
])
developers_can_push
=
to_boolean
(
params
[
:developers_can_push
])
params
=
{
p
rotected_branch_p
arams
=
{
name:
@branch
.
name
,
name:
@branch
.
name
,
}
}
service_args
=
[
user_project
,
current_user
,
params
,
service_args
=
[
user_project
,
current_user
,
p
rotected_branch_p
arams
,
developers_can_push:
developers_can_push
,
developers_can_push:
developers_can_push
,
developers_can_merge:
developers_can_merge
]
developers_can_merge:
developers_can_merge
]
...
...
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