Skip to content
Snippets Groups Projects
Commit 2f6374cd authored by Huzaifa Iftikhar's avatar Huzaifa Iftikhar :baby:
Browse files

Handle case when project statistics is nil

parent 9b47c95b
No related branches found
No related tags found
1 merge request!84935Add a function to determine if a project is inactive
......@@ -2869,7 +2869,7 @@ def enqueue_record_project_target_platforms
end
def inactive?
statistics.storage_size > ::Gitlab::CurrentSettings.inactive_projects_min_size_mb.megabytes &&
(statistics || build_statistics).storage_size > ::Gitlab::CurrentSettings.inactive_projects_min_size_mb.megabytes &&
last_activity_at < ::Gitlab::CurrentSettings.inactive_projects_send_warning_email_after_months.months.ago
end
......
......@@ -3357,14 +3357,14 @@ def stub_default_url_options(host)
context 'when project belongs to free namespace' do
let_it_be(:no_plan_group) { create(:group_with_plan, plan: nil) }
let_it_be(:project) { create(:project, namespace: no_plan_group) }
let_it_be_with_reload(:project) { create(:project, namespace: no_plan_group) }
it_behaves_like 'returns true if project is inactive'
end
end
context 'when not Gitlab.com' do
let_it_be(:project) { create(:project, name: 'test-project') }
let_it_be_with_reload(:project) { create(:project, name: 'test-project') }
it_behaves_like 'returns true if project is inactive'
end
......
......@@ -8179,7 +8179,7 @@ def has_external_wiki
end
describe '#inactive?' do
let_it_be(:project) { create(:project, name: 'test-project') }
let_it_be_with_reload(:project) { create(:project, name: 'test-project') }
it_behaves_like 'returns true if project is inactive'
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment