Fix comparing equality between `ActionController::Parameters` and a `Hash`....

This commit is contained in:
Daniel Juarez 2019-02-05 12:30:06 +00:00 committed by Sean McGivern
parent 55cb4bc9ca
commit 72b59d6e3b
3 changed files with 16 additions and 1 deletions

View File

@ -72,7 +72,7 @@ module ServiceParams
dynamic_params = @service.event_channel_names + @service.event_names # rubocop:disable Gitlab/ModuleWithInstanceVariables
service_params = params.permit(:id, service: allowed_service_params + dynamic_params)
if service_params[:service].is_a?(Hash)
if service_params[:service].is_a?(ActionController::Parameters)
FILTER_BLANK_PARAMS.each do |param|
service_params[:service].delete(param) if service_params[:service][param].blank?
end

View File

@ -0,0 +1,5 @@
---
title: Fix Jira Service password validation on project integration services.
merge_request: 24896
author: Daniel Juarez
type: fixed

View File

@ -152,6 +152,16 @@ describe Projects::ServicesController do
expect(service.namespace).not_to eq('updated_namespace')
end
end
context 'when activating JIRA service from a template' do
let(:template_service) { create(:jira_service, project: project, template: true) }
it 'activate JIRA service from template' do
put :update, params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: { active: true } }
expect(flash[:notice]).to eq 'JIRA activated.'
end
end
end
describe "GET #edit" do