From cf4c7c37fd0ff5afa9d8e18ad56648854faec331 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 ++ .../oauth_applications_management_spec.rb | 2 +- 3 files changed, 23 insertions(+), 18 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." diff --git a/spec/features/admin/oauth/oauth_applications_management_spec.rb b/spec/features/admin/oauth/oauth_applications_management_spec.rb index faaab28a4884..fd7c4bbbb1c6 100644 --- a/spec/features/admin/oauth/oauth_applications_management_spec.rb +++ b/spec/features/admin/oauth/oauth_applications_management_spec.rb @@ -93,7 +93,7 @@ expect(page).to have_test_selector("op-admin-oauth--applications-placeholder") end - context "with a seeded application" do + context "with a seeded application", with_flag: { built_in_oauth_applications: true } do before do OAuthApplicationsSeeder.new.seed_data! end