Skip to content

Commit

Permalink
refactor: Remove release 1 feature flags (M2-6906) (#1878)
Browse files Browse the repository at this point in the history
This PR removes all references to the `enableMultiInformant` and `enableMultiInformantTakeNow` feature flags. I've also taken the liberty of removing some unused components and related functions. There are probably others that could be removed, and I'd be happy to oblige if you have suggestions.

As part of this ticket I also made two related changes:
- The View Users menu item on the dashboard now points to the participants tab, instead of the applet overview tab
- The applet breadcrumb will now navigate to the applet overview tab, instead of the participants tab
  • Loading branch information
sultanofcardio authored Aug 1, 2024
1 parent a23fac4 commit c1ba765
Show file tree
Hide file tree
Showing 79 changed files with 67 additions and 2,765 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ describe('getActivityActions', () => {
},
roles: [],
featureFlags: {
enableMultiInformant: true,
enableMultiInformantTakeNow: true,
enableActivityAssign: true,
enableActivityFilterSort: true,
},
Expand Down Expand Up @@ -188,23 +186,6 @@ describe('getActivityActions', () => {
expectMenuItemIsDisplayed(menuItems, 'takeNow', true);
});

test('Take Now menu item is not displayed when feature flag is disabled', () => {
const menuItems = getActivityActions({
...defaultArgs,
roles: [Roles.Manager],
featureFlags: {
...defaultArgs.featureFlags,
enableMultiInformantTakeNow: false,
},
});

expectAllMenuItemsAreReturned(menuItems);
expectMenuItemIsDisplayed(menuItems, 'editActivity', true);
expectMenuItemIsDisplayed(menuItems, 'exportData', true);
expectMenuItemIsDisplayed(menuItems, 'assignActivity', true);
expectMenuItemIsDisplayed(menuItems, 'takeNow', false);
});

test('Assign Activity menu item is not displayed when feature flag is disabled', () => {
const menuItems = getActivityActions({
...defaultArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export const getActivityActions = ({
(checkIfCanEdit(roles) && !activity?.isPerformanceTask) ||
EditablePerformanceTasks.includes(activity?.performanceTaskType ?? '');
const canAccessData = checkIfCanAccessData(roles);
const canDoTakeNow =
featureFlags.enableMultiInformantTakeNow && hasParticipants && checkIfFullAccess(roles);
const canDoTakeNow = hasParticipants && checkIfFullAccess(roles);
const canAssignActivity =
checkIfCanManageParticipants(roles) && featureFlags.enableActivityAssign;
const showDivider = (canEdit || canAccessData) && (canDoTakeNow || canAssignActivity);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/modules/Dashboard/components/Banners/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './AddParticipantSuccessBanner';
export * from './ShellAccountSuccessBanner';
3 changes: 1 addition & 2 deletions src/modules/Dashboard/components/FlowGrid/FlowGrid.hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export function useFlowGridMenu({
const roles = appletId ? workspaceRoles?.data?.[appletId] : undefined;

const canEdit = checkIfCanEdit(roles);
const canDoTakeNow =
checkIfFullAccess(roles) && featureFlags.enableMultiInformantTakeNow && hasParticipants;
const canDoTakeNow = checkIfFullAccess(roles) && hasParticipants;
const canAccessData = checkIfCanAccessData(roles);
const canAssign = checkIfCanManageParticipants(roles) && featureFlags.enableActivityAssign;
const showDivider = (canEdit || canAccessData) && (canAssign || canDoTakeNow);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ describe('Dashboard > Applet > Activities screen', () => {
beforeEach(() => {
mockUseFeatureFlags.mockReturnValue({
featureFlags: {
enableMultiInformant: true,
enableMultiInformantTakeNow: true,
enableParticipantMultiInformant: false,
},
resetLDContext: jest.fn(),
Expand Down Expand Up @@ -253,51 +251,6 @@ describe('Dashboard > Applet > Activities screen', () => {
});
});

describe('Should hide Take now button for everyone if feature flag is off', () => {
test.each`
role | description
${Roles.Manager} | ${'Take Now for Manager'}
${Roles.SuperAdmin} | ${'Take Now for SuperAdmin'}
${Roles.Owner} | ${'Take Now for Owner'}
${Roles.Coordinator} | ${'Take Now for Coordinator'}
${Roles.Editor} | ${'Take Now for Editor'}
${Roles.Respondent} | ${'Take Now for Respondent'}
${Roles.Reviewer} | ${'Take Now for Reviewer'}
`('$description', async ({ role }: { role: Roles }) => {
mockGetRequestResponses({
[getAppletUrl]: successfulGetAppletMock,
[`/activities/applet/${mockedAppletId}`]: successfulGetAppletActivitiesMock,
[`/workspaces/${mockedOwnerId}/applets/${mockedAppletId}/respondents`]:
successfulEmptyHttpResponseMock,
[`/workspaces/${mockedOwnerId}/applets/${mockedAppletId}/managers`]:
successfulEmptyHttpResponseMock,
});

mockUseFeatureFlags.mockReturnValue({
featureFlags: {
enableMultiInformant: true,
enableMultiInformantTakeNow: false,
enableParticipantMultiInformant: false,
},
resetLDContext: jest.fn(),
});

renderWithProviders(<Activities />, {
preloadedState: getPreloadedState(role),
route,
routePath,
});

const actionDots = screen.queryAllByTestId(`${testId}-activity-actions-dots`)[0];
if (actionDots) {
await userEvent.click(actionDots);
await waitFor(() =>
expect(screen.queryByTestId(`${testId}-activity-take-now`)).toBe(null),
);
}
});
});

test('should pre-populate admin in Take Now modal and start assessment', async () => {
const mockedOwnerRespondent = {
id: mockedUserData.id,
Expand Down Expand Up @@ -705,8 +658,6 @@ describe('Dashboard > Applet > Activities screen', () => {
beforeEach(() => {
mockUseFeatureFlags.mockReturnValue({
featureFlags: {
enableMultiInformant: true,
enableMultiInformantTakeNow: true,
enableParticipantMultiInformant: true,
},
resetLDContext: jest.fn(),
Expand Down

This file was deleted.

107 changes: 0 additions & 107 deletions src/modules/Dashboard/features/Applet/AddUser/AddUser.test.tsx

This file was deleted.

Loading

0 comments on commit c1ba765

Please sign in to comment.