Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VACMS-15747 Feature toggle to launch nat outreach checkbox for all #15930

Merged
merged 3 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/sync/feature_toggle.features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ features:
feature_single_value_field_link: FEATURE_SINGLE_VALUE_FIELD_LINK
feature_health_connect_number: FEATURE_HEALTH_CONNECT_NUMBER
feature_event_outreach_checkbox: FEATURE_EVENT_OUTREACH_CHECKBOX
feature_event_outreach_checkbox_all: FEATURE_EVENT_OUTREACH_CHECKBOX_ALL
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class EntityEventSubscriber implements EventSubscriberInterface {
*/
const OUTREACH_CHECKBOX_FEATURE_NAME = 'feature_event_outreach_checkbox';

/**
* The Feature toggle name that controls displaying the checkbox to all users.
*/
const OUTREACH_CHECKBOX_ALL_NAME = 'feature_event_outreach_checkbox_all';

/**
* The list of users allowed to view the outreach checkbox.
*/
Expand Down Expand Up @@ -89,6 +94,13 @@ class EntityEventSubscriber implements EventSubscriberInterface {
*/
private bool $outreachCheckboxFeatureEnabled;

/**
* TRUE if the outreach checkbox feature toggle is enabled for all users.
*
* @var bool
*/
private bool $outreachCheckboxAllFeatureEnabled;

/**
* Constructs the EventSubscriber object.
*
Expand All @@ -103,6 +115,7 @@ public function __construct(UserPermsService $user_perms_service, AccountProxy $
$this->userPermsService = $user_perms_service;
$this->currentUser = $account_proxy->getAccount();
$this->outreachCheckboxFeatureEnabled = $feature_status->getStatus(self::OUTREACH_CHECKBOX_FEATURE_NAME);
$this->outreachCheckboxAllFeatureEnabled = $feature_status->getStatus(self::OUTREACH_CHECKBOX_ALL_NAME);
}

/**
Expand All @@ -123,7 +136,13 @@ public static function getSubscribedEvents(): array {
* TRUE if the outreach checkbox should be enabled.
*/
protected function outreachCheckboxEnabled(): bool {
// If both feature toggles are on, display the checkbox to all users.
if ($this->outreachCheckboxFeatureEnabled && $this->outreachCheckboxAllFeatureEnabled) {
return TRUE;
}
$admin = $this->userPermsService->hasAdminRole(TRUE);
// If only the primary outreach feature toggle is on, and the user is either
// an admin, or in the test user list, display the checkbox.
return (
$this->outreachCheckboxFeatureEnabled
&& (in_array($this->currentUser->id(), self::OUTREACH_CHECKBOX_TEST_USERS) || $admin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
Feature: Content Type: Event

Scenario: Log in and create an event.
Given I am logged in as a user with the "administrator" role
Given I am logged in as a user with the "content_admin" role
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

When I set the "feature_event_outreach_checkbox" feature toggle to "on"
And I set the "feature_event_outreach_checkbox_all" feature toggle to "on"
Then I create a "event" node

Scenario: Confirm that event form conditional fields are cleared out if parent options change
Expand Down
Loading