diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-10 13:40:11 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-10 13:40:11 +0200 |
commit | 6120dc261ab3700b7a19f683559494319b6a1b75 (patch) | |
tree | 9b9c9b0c5664f03af9732ebf3c0d01079533df94 /app/models/application_setting.rb | |
parent | 6c477d5b9496829eb5cb56ef32a0dd813be7dc16 (diff) | |
parent | cd735170d3bc5e71d46ba1e37249ae713b7842f8 (diff) | |
download | gitlab-ce-6120dc261ab3700b7a19f683559494319b6a1b75.tar.gz |
Merge branch 'master' into backstage/gb/migrate-stages-statuses
* master: (587 commits)
Increase GitLab QA screenshots size
Fix QA test scenario for creating a new project
Configure headless chrome screenshots correctly
Allow passing exceptions when creating project services
Also inject new route helpers into includers of GitlabRoutingHelper
Remove many N+1 queries with merge requests API
fix milestones finder failing spec
Make wrong migrations idempotent
Remove double border on last group row
Update tests to test what the component renders and what the clicks calls
Username and password are no longer stripped from import url on import
Change `sign_out` usage to `gitlab_sign_out` in one spec
Send Gitaly Repository with /api/internal/allowed
Resolve "Liberation Mono weird font rendering on Fedora/openSUSE/other Linux distros"
Force mobile view for admin projects
fix spec
Mark a subgroup-related spec as PostgreSQL-only
Use vue .prevent to prevent the click
Add members-list class to admin projects page
Fix another typo in SHA attribute spec
...
Conflicts:
db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
db/schema.rb
lib/gitlab/background_migration/migrate_build_stage_id_reference.rb
spec/migrations/migrate_stage_id_reference_in_background_spec.rb
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r-- | app/models/application_setting.rb | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 668caef0d2c..14516091495 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -13,13 +13,13 @@ class ApplicationSetting < ActiveRecord::Base [\r\n] # any number of newline characters }x - serialize :restricted_visibility_levels # rubocop:disable Cop/ActiverecordSerialize - serialize :import_sources # rubocop:disable Cop/ActiverecordSerialize - serialize :disabled_oauth_sign_in_sources, Array # rubocop:disable Cop/ActiverecordSerialize - serialize :domain_whitelist, Array # rubocop:disable Cop/ActiverecordSerialize - serialize :domain_blacklist, Array # rubocop:disable Cop/ActiverecordSerialize - serialize :repository_storages # rubocop:disable Cop/ActiverecordSerialize - serialize :sidekiq_throttling_queues, Array # rubocop:disable Cop/ActiverecordSerialize + serialize :restricted_visibility_levels # rubocop:disable Cop/ActiveRecordSerialize + serialize :import_sources # rubocop:disable Cop/ActiveRecordSerialize + serialize :disabled_oauth_sign_in_sources, Array # rubocop:disable Cop/ActiveRecordSerialize + serialize :domain_whitelist, Array # rubocop:disable Cop/ActiveRecordSerialize + serialize :domain_blacklist, Array # rubocop:disable Cop/ActiveRecordSerialize + serialize :repository_storages # rubocop:disable Cop/ActiveRecordSerialize + serialize :sidekiq_throttling_queues, Array # rubocop:disable Cop/ActiveRecordSerialize cache_markdown_field :sign_in_text cache_markdown_field :help_page_text @@ -234,6 +234,7 @@ class ApplicationSetting < ActiveRecord::Base koding_url: nil, max_artifacts_size: Settings.artifacts['max_size'], max_attachment_size: Settings.gitlab['max_attachment_size'], + performance_bar_allowed_group_id: nil, plantuml_enabled: false, plantuml_url: nil, recaptcha_enabled: false, @@ -336,6 +337,48 @@ 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 + + # 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, 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 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 |