diff options
author | Douwe Maan <douwe@selenight.nl> | 2018-06-25 18:39:23 +0200 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2018-06-25 18:39:23 +0200 |
commit | 8c5eff29de2c6204deeb327594af1a936b2d9f7e (patch) | |
tree | dcfdaf3aa87d229cc6169025ba815049de77f749 /lib/api/branches.rb | |
parent | 9490c378338bd415ad0a53897a85b6acda4ec676 (diff) | |
download | gitlab-ce-8c5eff29de2c6204deeb327594af1a936b2d9f7e.tar.gz |
Fix branch API can_push attribute and add specsdm-branch-api-can-push-fix
Diffstat (limited to 'lib/api/branches.rb')
-rw-r--r-- | lib/api/branches.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb index 13cfba728fa..4b223a391ae 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -45,6 +45,7 @@ module API present( paginate(::Kaminari.paginate_array(branches)), with: Entities::Branch, + current_user: current_user, project: user_project, merged_branch_names: merged_branch_names ) @@ -63,7 +64,7 @@ module API get do branch = find_branch!(params[:branch]) - present branch, with: Entities::Branch, project: user_project + present branch, with: Entities::Branch, current_user: current_user, project: user_project end end @@ -101,7 +102,7 @@ module API end if protected_branch.valid? - present branch, with: Entities::Branch, project: user_project + present branch, with: Entities::Branch, current_user: current_user, project: user_project else render_api_error!(protected_branch.errors.full_messages, 422) end @@ -121,7 +122,7 @@ module API protected_branch = user_project.protected_branches.find_by(name: branch.name) protected_branch&.destroy - present branch, with: Entities::Branch, project: user_project + present branch, with: Entities::Branch, current_user: current_user, project: user_project end desc 'Create branch' do @@ -140,6 +141,7 @@ module API if result[:status] == :success present result[:branch], with: Entities::Branch, + current_user: current_user, project: user_project else render_api_error!(result[:message], 400) |