From c30db94fc9392821a533c80eecb90f7a7ce42f6b Mon Sep 17 00:00:00 2001 From: Nils Rauch Date: Fri, 17 Nov 2023 15:33:18 +0100 Subject: [PATCH] WIP feature gate for new managed register --- .../event/participation_contact_data/managed_controller.rb | 7 +++++++ app/helpers/youth/dropdown/event/participant_add.rb | 7 ++++++- config/settings.yml | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/controllers/event/participation_contact_data/managed_controller.rb b/app/controllers/event/participation_contact_data/managed_controller.rb index dd19b6a4..9a9718f9 100644 --- a/app/controllers/event/participation_contact_data/managed_controller.rb +++ b/app/controllers/event/participation_contact_data/managed_controller.rb @@ -8,6 +8,8 @@ class Event::ParticipationContactData::ManagedController < Event::ParticipationContactDatasController + before_action :assert_feature_enabled + def update if any_duplicates? entry.errors.add(:base, :duplicates_present) if any_duplicates? @@ -44,4 +46,9 @@ def person_duplicate_finder def privacy_policy_param params[:event_participation_contact_datas_managed][:privacy_policy_accepted] end + + def assert_feature_enabled + FeatureGate.assert!(:'people.people_managers.self_service_managed_creation') + end + end end diff --git a/app/helpers/youth/dropdown/event/participant_add.rb b/app/helpers/youth/dropdown/event/participant_add.rb index a24bc58d..43818ca7 100644 --- a/app/helpers/youth/dropdown/event/participant_add.rb +++ b/app/helpers/youth/dropdown/event/participant_add.rb @@ -69,7 +69,7 @@ def init_items_with_manageds(url_options) end end - if event.external_applications? + if register_new_managed? opts = url_options.merge(event_role: { type: event.participant_types.first.sti_name }) add_item( translate('.register_new_managed'), @@ -104,6 +104,11 @@ def participant_types_sub_items(opts) ::Dropdown::Item.new(translate(:as, role: type.label), link) end end + + def register_new_managed? + event.external_applications? && + FeatureGate.enabled?(:'people.people_managers.self_service_managed_creation') + end end end end diff --git a/config/settings.yml b/config/settings.yml index ac17edbe..2467b8d4 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -6,3 +6,5 @@ people: people_managers: enabled: true + self_service_managed_creation: + enabled: true