From c40f87002f3751f4692b25709caead94b7397fd6 Mon Sep 17 00:00:00 2001 From: Eric Schubert Date: Fri, 13 Sep 2024 13:09:45 +0200 Subject: [PATCH] [#53620] add feature flag for buit-in apps --- .../applications/index_component.html.erb | 36 ++++++++++--------- config/initializers/feature_decisions.rb | 3 ++ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/app/components/oauth/applications/index_component.html.erb b/app/components/oauth/applications/index_component.html.erb index 856ff7b0b136..e5f0d0b4beed 100644 --- a/app/components/oauth/applications/index_component.html.erb +++ b/app/components/oauth/applications/index_component.html.erb @@ -1,28 +1,30 @@ <%= component_wrapper do flex_layout do |index_container| - index_container.with_row do - render(border_box_container(mb: 4, data: { - 'test-selector': "op-admin-oauth--built-in-applications" - })) do |component| - component.with_header(font_weight: :bold) do - render(Primer::Beta::Text.new) do - t("oauth.header.builtin_applications") + if OpenProject::FeatureDecisions.built_in_oauth_applications_active? + index_container.with_row do + render(border_box_container(mb: 4, data: { + 'test-selector': "op-admin-oauth--built-in-applications" + })) do |component| + component.with_header(font_weight: :bold) do + render(Primer::Beta::Text.new) do + t("oauth.header.builtin_applications") + end end - end - if @built_in_applications.empty? - component.with_row do - render(Primer::Beta::Text.new(data: { - 'test-selector': "op-admin-oauth--built-in-applications-placeholder" - })) do - t("oauth.empty_application_lists") + if @built_in_applications.empty? + component.with_row do + render(Primer::Beta::Text.new(data: { + 'test-selector': "op-admin-oauth--built-in-applications-placeholder" + })) do + t("oauth.empty_application_lists") + end end end - end - @built_in_applications.each do |application| - component.with_row { render(OAuth::Applications::ApplicationRowComponent.new(application:)) } + @built_in_applications.each do |application| + component.with_row { render(OAuth::Applications::ApplicationRowComponent.new(application:)) } + end end end end diff --git a/config/initializers/feature_decisions.rb b/config/initializers/feature_decisions.rb index dea98a89d888..7531b7944083 100644 --- a/config/initializers/feature_decisions.rb +++ b/config/initializers/feature_decisions.rb @@ -50,3 +50,6 @@ OpenProject::FeatureDecisions.add :enable_custom_field_for_multiple_projects, description: "Allow a custom field to be enabled for multiple projects at once. " \ "See work package #56909 for more details." + +OpenProject::FeatureDecisions.add :built_in_oauth_applications, + description: "Allows the display and use of built-in OAuth applications."