BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
db0182e2
Commit
db0182e2
authored
Oct 24, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement third round of review comments from @DouweM.
Extract/mutate `params` in the `execute` method of the API services, rather than in `initialize`.
parent
1051087a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
13 deletions
+4
-13
api_create_service.rb
app/services/protected_branches/api_create_service.rb
+2
-8
api_update_service.rb
app/services/protected_branches/api_update_service.rb
+2
-5
No files found.
app/services/protected_branches/api_create_service.rb
View file @
db0182e2
...
...
@@ -4,22 +4,16 @@
# lives in this service.
module
ProtectedBranches
class
ApiCreateService
<
BaseService
def
initialize
(
project
,
user
,
params
)
@developers_can_merge
=
params
.
delete
(
:developers_can_merge
)
@developers_can_push
=
params
.
delete
(
:developers_can_push
)
super
(
project
,
user
,
params
)
end
def
execute
push_access_level
=
if
@developers_can_push
if
params
.
delete
(
:developers_can_push
)
Gitlab
::
Access
::
DEVELOPER
else
Gitlab
::
Access
::
MASTER
end
merge_access_level
=
if
@developers_can_merge
if
params
.
delete
(
:developers_can_merge
)
Gitlab
::
Access
::
DEVELOPER
else
Gitlab
::
Access
::
MASTER
...
...
app/services/protected_branches/api_update_service.rb
View file @
db0182e2
...
...
@@ -4,13 +4,10 @@
# lives in this service.
module
ProtectedBranches
class
ApiUpdateService
<
BaseService
def
initialize
(
project
,
user
,
params
)
@developers_can_merge
=
params
.
delete
(
:developers_can_merge
)
def
execute
(
protected_branch
)
@developers_can_push
=
params
.
delete
(
:developers_can_push
)
super
(
project
,
user
,
params
)
end
@developers_can_merge
=
params
.
delete
(
:developers_can_merge
)
def
execute
(
protected_branch
)
@protected_branch
=
protected_branch
protected_branch
.
transaction
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