Commit db0182e2 authored by Timothy Andrew's avatar Timothy Andrew

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
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment