diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-23 18:08:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-23 18:08:38 +0300 |
commit | 16dbaf57bc4d87aa8a2bca8bf9db7cab26d841c4 (patch) | |
tree | f5c6a87c9fbc0677c965d07b85a305cb2cb0fcc7 /lib/gitlab/gon_helper.rb | |
parent | 3e68d3848770b492d314f8e2967c37f7fdd5d143 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/gon_helper.rb')
-rw-r--r-- | lib/gitlab/gon_helper.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index 9f18513f066..dd64f1c11ee 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -53,7 +53,6 @@ module Gitlab # made globally available to the frontend push_frontend_feature_flag(:usage_data_api, type: :ops, default_enabled: :yaml) push_frontend_feature_flag(:security_auto_fix, default_enabled: false) - push_frontend_feature_flag(:improved_emoji_picker, default_enabled: :yaml) push_frontend_feature_flag(:new_header_search, default_enabled: :yaml) push_frontend_feature_flag(:bootstrap_confirmation_modals, default_enabled: :yaml) push_frontend_feature_flag(:sandboxed_mermaid, default_enabled: :yaml) @@ -73,6 +72,15 @@ module Gitlab push_to_gon_attributes(:features, name, enabled) end + # Exposes the state of a feature flag to the frontend code. + # Can be used for more complex feature flag checks. + # + # name - The name of the feature flag, e.g. `my_feature`. + # enabled - Boolean to be pushed directly to the frontend. Should be fetched by checking a feature flag. + def push_force_frontend_feature_flag(name, enabled) + push_to_gon_attributes(:features, name, !!enabled) + end + def push_to_gon_attributes(key, name, enabled) var_name = name.to_s.camelize(:lower) # Here the `true` argument signals gon that the value should be merged |