Skip to content

Commit

Permalink
WIP feature gate for new managed register
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWalkingLeek committed Nov 17, 2023
1 parent 44e4a45 commit c30db94
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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
7 changes: 6 additions & 1 deletion app/helpers/youth/dropdown/event/participant_add.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
people:
people_managers:
enabled: true
self_service_managed_creation:
enabled: true

0 comments on commit c30db94

Please sign in to comment.