summaryrefslogtreecommitdiff
path: root/app/models/application_setting.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r--app/models/application_setting.rb50
1 files changed, 5 insertions, 45 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index e8ccb320fae..3d58a14882f 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -230,6 +230,7 @@ class ApplicationSetting < ActiveRecord::Base
after_commit do
reset_memoized_terms
end
+ after_commit :expire_performance_bar_allowed_user_ids_cache, if: -> { previous_changes.key?('performance_bar_allowed_group_id') }
def self.defaults
{
@@ -359,17 +360,6 @@ class ApplicationSetting < ActiveRecord::Base
Array(read_attribute(:repository_storages))
end
- # DEPRECATED
- # repository_storage is still required in the API. Remove in 9.0
- # Still used in API v3
- def repository_storage
- repository_storages.first
- end
-
- def repository_storage=(value)
- self.repository_storages = [value]
- end
-
def default_project_visibility=(level)
super(Gitlab::VisibilityLevel.level_value(level))
end
@@ -386,31 +376,6 @@ class ApplicationSetting < ActiveRecord::Base
super(levels.map { |level| Gitlab::VisibilityLevel.level_value(level) })
end
- def performance_bar_allowed_group_id=(group_full_path)
- group_full_path = nil if group_full_path.blank?
-
- if group_full_path.nil?
- if group_full_path != performance_bar_allowed_group_id
- super(group_full_path)
- Gitlab::PerformanceBar.expire_allowed_user_ids_cache
- end
-
- return
- end
-
- group = Group.find_by_full_path(group_full_path)
-
- if group
- if group.id != performance_bar_allowed_group_id
- super(group.id)
- Gitlab::PerformanceBar.expire_allowed_user_ids_cache
- end
- else
- super(nil)
- Gitlab::PerformanceBar.expire_allowed_user_ids_cache
- end
- end
-
def performance_bar_allowed_group
Group.find_by_id(performance_bar_allowed_group_id)
end
@@ -420,15 +385,6 @@ class ApplicationSetting < ActiveRecord::Base
performance_bar_allowed_group_id.present?
end
- # - If `enable` is true, we early return since the actual attribute that holds
- # the enabling/disabling is `performance_bar_allowed_group_id`
- # - If `enable` is false, we set `performance_bar_allowed_group_id` to `nil`
- def performance_bar_enabled=(enable)
- return if Gitlab::Utils.to_boolean(enable)
-
- self.performance_bar_allowed_group_id = nil
- end
-
# Choose one of the available repository storage options. Currently all have
# equal weighting.
def pick_repository_storage
@@ -506,4 +462,8 @@ class ApplicationSetting < ActiveRecord::Base
errors.add(:terms, "You need to set terms to be enforced") unless terms.present?
end
+
+ def expire_performance_bar_allowed_user_ids_cache
+ Gitlab::PerformanceBar.expire_allowed_user_ids_cache
+ end
end