From 92eb3974ac28aff7c78f4ca0cbafbad842fc7160 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 26 Dec 2014 11:39:12 +0100 Subject: Add option to disable/enable developers push to already protected branches. --- .../projects/protected_branches_controller.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/controllers/projects/protected_branches_controller.rb') 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 -- cgit v1.2.3