From a32a410fb9bfcd378840b61426a54fd56d2ebd33 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Thu, 23 Aug 2018 23:54:43 +0200 Subject: Move wiki statistics deletion to after_destroy --- app/models/project.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 8f631d7f0ed..37231df979e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -85,8 +85,8 @@ class Project < ActiveRecord::Base after_create :create_project_feature, unless: :project_feature after_create -> { SiteStatistic.track(STATISTICS_ATTRIBUTE) } - before_destroy ->(project) { project.project_feature.untrack_statistics_for_deletion! } - after_destroy -> { SiteStatistic.untrack(STATISTICS_ATTRIBUTE) } + before_destroy ->(project) { project.project_feature } # keep reference so we can untrack later + after_destroy :untrack_site_statistics after_create :create_ci_cd_settings, unless: :ci_cd_settings, @@ -2093,6 +2093,11 @@ class Project < ActiveRecord::Base Gitlab::PagesTransfer.new.rename_project(path_before, self.path, namespace.full_path) end + def untrack_site_statistics + SiteStatistic.untrack(STATISTICS_ATTRIBUTE) + SiteStatistic.project_feature.untrack_statistics_for_deletion! + end + def execute_rename_repository_hooks!(full_path_before) # When we import a project overwriting the original project, there # is a move operation. In that case we don't want to send the instructions. -- cgit v1.2.1