Commit 595b3d00 authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch 'fix-500-non-existant-integration' into 'master'

Fix 500 error when visiting a non-existing integration

See merge request gitlab-org/gitlab!84076
parents 1545a53b cfb03820
......@@ -1484,7 +1484,7 @@ class Project < ApplicationRecord
end
def find_or_initialize_integration(name)
return if disabled_integrations.include?(name)
return if disabled_integrations.include?(name) || Integration.available_integration_names.exclude?(name)
find_integration(integrations, name) || build_from_instance(name) || build_integration(name)
end
......
......@@ -6288,6 +6288,10 @@ RSpec.describe Project, factory_default: :keep do
expect(subject.find_or_initialize_integration('prometheus')).to be_nil
end
it 'returns nil if integration does not exist' do
expect(subject.find_or_initialize_integration('non-existing')).to be_nil
end
context 'with an existing integration' do
subject { create(:project) }
......
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