summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-09-30 13:14:46 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-10-24 11:33:38 +0530
commit1051087ac4efc3dbf45bd075e36af647d2b66d62 (patch)
tree17480547c9791321ad330985a02d60ddae5684b9 /lib
parentb803bc7bb8ad481790d01848902e80602e77da67 (diff)
downloadgitlab-ce-1051087ac4efc3dbf45bd075e36af647d2b66d62.tar.gz
Implement second round of review comments from @DouweM.
- Pass `developers_and_merge` and `developers_can_push` in `params` instead of using keyword arguments. - Refactor a slightly complex boolean check to a simple `nil?` check.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/branches.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index 7feb47784b7..6d827448994 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -54,16 +54,13 @@ module API
not_found!('Branch') unless @branch
protected_branch = user_project.protected_branches.find_by(name: @branch.name)
- developers_can_merge = to_boolean(params[:developers_can_merge])
- developers_can_push = to_boolean(params[:developers_can_push])
-
protected_branch_params = {
name: @branch.name,
+ developers_can_push: to_boolean(params[:developers_can_push]),
+ developers_can_merge: to_boolean(params[:developers_can_merge])
}
- service_args = [user_project, current_user, protected_branch_params,
- developers_can_push: developers_can_push,
- developers_can_merge: developers_can_merge]
+ service_args = [user_project, current_user, protected_branch_params]
protected_branch = if protected_branch
ProtectedBranches::ApiUpdateService.new(*service_args).execute(protected_branch)