diff options
author | Valery Sizov <valery@gitlab.com> | 2018-09-25 16:29:17 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2018-09-25 17:49:39 +0300 |
commit | 15d011d64d579616dd9df3e3e5082ed5b99bcdf8 (patch) | |
tree | cb89f3316d037e19ddc5e1b39fdf37955313e103 /app/models/project_feature.rb | |
parent | cb0f024cd4c4aa51c7824e4e1a6c4d0f307afad1 (diff) |
Geo: sync disabled wikis. Stage 2
We started syncing all the wiki regardless of the fact it's disabled or
not. We couldn't do that in one stage because of needing of smoth update
and deprecating things. This is the second stage that finally removes
unused columns in the geo_node_status table.
Diffstat (limited to 'app/models/project_feature.rb')
-rw-r--r-- | app/models/project_feature.rb | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb index d74cb2506ba..4a0324e8b5c 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -21,7 +21,6 @@ class ProjectFeature < ActiveRecord::Base ENABLED = 20 FEATURES = %i(issues merge_requests wiki snippets builds repository).freeze - STATISTICS_ATTRIBUTE = 'wikis_count'.freeze class << self def access_level_attribute(feature) @@ -55,9 +54,6 @@ class ProjectFeature < ActiveRecord::Base default_value_for :wiki_access_level, value: ENABLED, allows_nil: false default_value_for :repository_access_level, value: ENABLED, allows_nil: false - after_create ->(model) { SiteStatistic.track(STATISTICS_ATTRIBUTE) if model.wiki_enabled? } - after_update :update_site_statistics - def feature_available?(feature, user) get_permission(user, access_level(feature)) end @@ -82,30 +78,8 @@ class ProjectFeature < ActiveRecord::Base issues_access_level > DISABLED end - # This is a workaround for the removal hooks not been triggered when removing a Project. - # - # ProjectFeature is removed using database cascade index rule. - # This method is called by Project model when deletion starts. - def untrack_statistics_for_deletion! - return unless wiki_enabled? - - SiteStatistic.untrack(STATISTICS_ATTRIBUTE) - end - private - def update_site_statistics - return unless wiki_access_level_changed? - - if self.wiki_access_level_was == DISABLED - # possible new states are PRIVATE / ENABLED, both should be tracked - SiteStatistic.track(STATISTICS_ATTRIBUTE) - elsif self.wiki_access_level == DISABLED - # old state was either PRIVATE / ENABLED, only untrack if new state is DISABLED - SiteStatistic.untrack(STATISTICS_ATTRIBUTE) - end - end - # Validates builds and merge requests access level # which cannot be higher than repository access level def repository_children_level |