diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2016-07-19 10:36:18 +0200 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2016-07-19 11:12:03 +0200 |
commit | e552b4af26b68a8b4bedc775a128a8ecd59ff689 (patch) | |
tree | a579e7051dbf385946056a38525000a441c405ff /lib/api/branches.rb | |
parent | 54d26c89f66abb2bfec7403fd6b3ed7700e73766 (diff) | |
download | gitlab-ce-e552b4af26b68a8b4bedc775a128a8ecd59ff689.tar.gz |
API: Expose 'developers_can_merge' for branches
Diffstat (limited to 'lib/api/branches.rb')
-rw-r--r-- | lib/api/branches.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb index cd33091d9f4..b77eebc729a 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -37,6 +37,7 @@ module API # id (required) - The ID of a project # branch (required) - The name of the branch # developers_can_push (optional) - Flag if developers can push to that branch + # developers_can_merge (optional) - Flag if developers can merge to that branch # Example Request: # PUT /projects/:id/repository/branches/:branch/protect put ':id/repository/branches/:branch/protect', @@ -47,12 +48,15 @@ module API not_found!('Branch') unless @branch protected_branch = user_project.protected_branches.find_by(name: @branch.name) developers_can_push = to_boolean(params[:developers_can_push]) + developers_can_merge = to_boolean(params[:developers_can_merge]) if protected_branch protected_branch.update(developers_can_push: developers_can_push) unless developers_can_push.nil? + protected_branch.update(developers_can_merge: developers_can_merge) unless developers_can_merge.nil? else user_project.protected_branches.create(name: @branch.name, - developers_can_push: developers_can_push || false) + developers_can_push: developers_can_push || false, + developers_can_merge: developers_can_merge || false) end present @branch, with: Entities::RepoObject, project: user_project |