Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-09-30 10:44:46 +0300
committerTimothy Andrew <mail@timothyandrew.net>2016-10-24 09:03:38 +0300
commit1051087ac4efc3dbf45bd075e36af647d2b66d62 (patch)
tree17480547c9791321ad330985a02d60ddae5684b9 /lib/api/branches.rb
parentb803bc7bb8ad481790d01848902e80602e77da67 (diff)
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/api/branches.rb')
-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)