Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-07-07 03:34:51 +0300
committerRémy Coutable <remy@rymai.me>2017-07-07 03:34:51 +0300
commit97611c88fcbae6b025750e6ebf2061a3d87d9753 (patch)
tree1d4ff635a807a49f99af219dc83c265a3465a4a6 /app/models/application_setting.rb
parent040eeb1039b4298ea56a670a0a4ae511288806d6 (diff)
Don't use Flipper for the Performance Bar
The implementation now simply rely on the `performance_bar_allowed_group_id` Application Setting. Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r--app/models/application_setting.rb48
1 files changed, 27 insertions, 21 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index c6d8e45c86d..4f9c7235a30 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -338,39 +338,45 @@ class ApplicationSetting < ActiveRecord::Base
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)
- return unless group && group.id != performance_bar_allowed_group_id
- super(group.id)
- Gitlab::PerformanceBar.expire_allowed_user_ids_cache
+ 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
- # Return true is the Performance Bar is available globally or for the
- # `performance_team` feature group
- def performance_bar_enabled?
- feature = Feature.get(:performance_bar)
-
- feature.on? || feature.groups_value.include?('performance_team')
+ # Return true if the Performance Bar is enabled for a given group
+ def performance_bar_enabled
+ performance_bar_allowed_group_id.present?
end
- # - If `enable` is true, enable the `performance_bar` feature for the
- # `performance_team` feature group
- # - If `enable` is false, disable the `performance_bar` feature globally
+ # - 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)
- feature = Feature.get(:performance_bar)
- performance_bar_on = performance_bar_enabled?
+ return if enable
- if enable && !performance_bar_on
- feature.enable_group(:performance_team)
- Gitlab::PerformanceBar.expire_allowed_user_ids_cache
- elsif !enable && performance_bar_on
- feature.disable
- Gitlab::PerformanceBar.expire_allowed_user_ids_cache
- end
+ self.performance_bar_allowed_group_id = nil
end
# Choose one of the available repository storage options. Currently all have