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:
authorMarin Jankovski <maxlazio@gmail.com>2014-12-26 13:39:12 +0300
committerMarin Jankovski <maxlazio@gmail.com>2014-12-26 13:39:12 +0300
commit92eb3974ac28aff7c78f4ca0cbafbad842fc7160 (patch)
treedaa081e7ef8cd4d1527000dbc5a7aca5caefe9af /app/controllers/projects/protected_branches_controller.rb
parent770b2a5cfbec1081756bfa2d8bf046b7b16bb638 (diff)
Add option to disable/enable developers push to already protected branches.
Diffstat (limited to 'app/controllers/projects/protected_branches_controller.rb')
-rw-r--r--app/controllers/projects/protected_branches_controller.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/projects/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb
index a0df392e424..ac68992faa0 100644
--- a/app/controllers/projects/protected_branches_controller.rb
+++ b/app/controllers/projects/protected_branches_controller.rb
@@ -15,6 +15,23 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
redirect_to project_protected_branches_path(@project)
end
+ def update
+ protected_branch = @project.protected_branches.find(params[:id])
+
+ if protected_branch &&
+ protected_branch.update_attributes(
+ developers_can_push: params[:developers_can_push]
+ )
+ flash[:notice] = 'Branch was successfully updated.'
+ else
+ flash[:alert] = 'Could not update the branch.'
+ end
+
+ respond_to do |format|
+ format.html { redirect_to project_protected_branches_path }
+ end
+ end
+
def destroy
@project.protected_branches.find(params[:id]).destroy