Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.1 on 2022-01-26 at 16:00 UTC+1 (a few minutes of down time)

Commit 6f16f1a5 authored by Gabriel Mazetto's avatar Gabriel Mazetto
Browse files

Move wiki statistics deletion to after_destroy

parent 79879ec317b3
......@@ -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 @@ def after_rename_repository(full_path_before, path_before)
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.
......
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