Commit a7246f95 authored by Kerri Miller's avatar Kerri Miller

Guard against missing namespace_settings

In some cases, namespace_settings can be absent; other code accessing
this from group have similar implementations of safe navigation.

Making this change also exposed that Project#adjourned_deletion?,
despite the boolean promise implied by ?, can also return a nil for some
cases. All calls to this method test for boolean, relying on Ruby
interpreting nil as false, so this one test, explicitly testing for
nil-ness, fails.
parent 2dd20a94
......@@ -930,9 +930,13 @@ module EE
end
end
# Return the group's setting for delayed deletion, false for user namespace projects
# Return the group's setting for delayed deletion, false for user namespace
# projects
#
def group_deletion_mode_configured?
group && group.namespace_settings.delayed_project_removal?
return false unless group&.namespace_settings
group.namespace_settings.delayed_project_removal?
end
def latest_ingested_security_pipeline
......
......@@ -2953,7 +2953,7 @@ RSpec.describe Project do
end
it 'deletes immediately' do
expect(user_project.adjourned_deletion?).to be nil
expect(user_project.adjourned_deletion?).to be_falsey
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