From 2ee86441158076344a07f2715a148a5bdbe161b0 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Mon, 30 Jan 2017 13:21:02 -0600 Subject: Fixed tests, changed dispatcher routing to the 'repository:show' Also modified the render calls to the deploy_keys and protected_branches partials --- app/controllers/projects/protected_branches_controller.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (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 18d25f91c96..ac886f0739a 100644 --- a/app/controllers/projects/protected_branches_controller.rb +++ b/app/controllers/projects/protected_branches_controller.rb @@ -1,9 +1,9 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController + include RepositoryHelper # Authorize before_action :require_non_empty_project before_action :authorize_admin_project! before_action :load_protected_branch, only: [:show, :update, :destroy] - before_action :load_protected_branches, only: [:index] layout "project_settings" @@ -13,13 +13,10 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController def create @protected_branch = ::ProtectedBranches::CreateService.new(@project, current_user, protected_branch_params).execute - if @protected_branch.persisted? - redirect_to namespace_project_settings_repository_path(@project.namespace, @project) - else - load_protected_branches - load_gon_index - render :index + unless @protected_branch.persisted? + flash[:alert] = @protected_branches.errors.full_messages.join(',').html_safe end + redirect_to namespace_project_settings_repository_path(@project.namespace, @project) end def show -- cgit v1.2.1