Commit b849aae3 authored by Robert Speicher's avatar Robert Speicher Committed by Ruben Davila

Merge branch 'issue_1059' into 'master'

Fix prevent_secrets checkbox on admin view

fixes #1059

See merge request !761
parent 1bcad97b
......@@ -16,6 +16,7 @@ v 8.12.2
- Only update issuable labels if they have been changed
- Fix bug where 'Search results' repeated many times when a search in the emoji search form is cleared (Xavier Bick) (@zeiv)
- Fix resolve discussion buttons endpoint path
- Fix prevent_secrets checkbox on admin view
v 8.12.1
- Fix a memory leak in HTML::Pipeline::SanitizationFilter::WHITELIST
......
......@@ -3,16 +3,16 @@ class Admin::PushRulesController < Admin::ApplicationController
respond_to :html
def index
def show
end
def update
@push_rule.update_attributes(push_rule_params.merge(is_sample: true))
@push_rule.update_attributes(push_rule_params)
if @push_rule.valid?
redirect_to admin_push_rules_path, notice: 'Push Rules updated successfully.'
redirect_to admin_push_rule_path, notice: 'Push Rule updated successfully.'
else
render :index
render :show
end
end
......@@ -20,7 +20,8 @@ class Admin::PushRulesController < Admin::ApplicationController
def push_rule_params
params.require(:push_rule).permit(:deny_delete_tag, :delete_branch_regex,
:commit_message_regex, :force_push_regex, :author_email_regex, :member_check, :file_name_regex, :max_file_size)
:commit_message_regex, :force_push_regex, :author_email_regex, :member_check,
:file_name_regex, :max_file_size, :prevent_secrets)
end
def push_rule
......
......@@ -47,7 +47,7 @@
Spam Logs
= nav_link(controller: :push_rules) do
= link_to admin_push_rules_path, title: 'Push Rules' do
= link_to admin_push_rule_path, title: 'Push Rules' do
%span
Push Rules
......
......@@ -259,7 +259,7 @@ Rails.application.routes.draw do
end
end
resources :push_rules, only: [:index, :update]
resource :push_rule, only: [:show, :update]
resource :impersonation, only: :destroy
......
require 'spec_helper'
describe Admin::PushRulesController do
let(:admin) { create(:admin) }
before do
sign_in(admin)
end
describe '#update' do
it 'updates sample push rule' do
params =
{ deny_delete_tag: true, delete_branch_regex: "any", commit_message_regex: "any",
force_push_regex: "any", author_email_regex: "any", member_check: true, file_name_regex: "any",
max_file_size: "0", prevent_secrets: true
}
expect_any_instance_of(PushRule).to receive(:update_attributes).with(params)
patch :update, push_rule: params
expect(response).to redirect_to(admin_push_rule_path)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment