Skip to content
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: 0 additions & 1 deletion src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ const CONST = {
GLOBAL_REIMBURSEMENTS_ON_ND: 'globalReimbursementsOnND',
IS_TRAVEL_VERIFIED: 'isTravelVerified',
PLAID_COMPANY_CARDS: 'plaidCompanyCards',
TRACK_FLOWS: 'trackFlows',
NEWDOT_REVERT_SPLITS: 'newDotRevertSplits',
NEWDOT_UPDATE_SPLITS: 'newDotUpdateSplits',
EXPENSIFY_CARD_EU_UK: 'expensifyCardEuUk',
Expand Down
8 changes: 8 additions & 0 deletions src/libs/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ function isBetaEnabled(beta: Beta, betas: OnyxEntry<Beta[]>, betaConfiguration?:
return isFeatureEnabled || hasAllBetasEnabled;
}

/**
* Track flows are temporarily disabled.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion for next time: explain why and until when it's supposed to be temporarily disabled.
And also ideally explain in the PR description 🙏

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Dang, thanks a lot for flagging this, I completely missed it! 🤦‍♂️

I’ve updated the PR description to add more context. Do you think it would also make sense to open a follow-up PR to include links to the discussions directly in the code?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it's fine with the context from the PR description now, thanks for adding it.

*/
function canUseTrackFlows(): boolean {
return false;
}

export default {
canUseLinkPreviews,
canUseTrackFlows,
isBetaEnabled,
};
3 changes: 2 additions & 1 deletion src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavig
import type {ReportDetailsNavigatorParamList} from '@libs/Navigation/types';
import {getPersonalDetailsForAccountIDs} from '@libs/OptionsListUtils';
import Parser from '@libs/Parser';
import Permissions from '@libs/Permissions';
import {isPolicyAdmin as isPolicyAdminUtil, isPolicyEmployee as isPolicyEmployeeUtil, shouldShowPolicy} from '@libs/PolicyUtils';
import {getOneTransactionThreadReportID, getOriginalMessage, getTrackExpenseActionableWhisper, isDeletedAction, isMoneyRequestAction, isTrackExpenseAction} from '@libs/ReportActionsUtils';
import {
Expand Down Expand Up @@ -425,7 +426,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
);
},
});
if (isBetaEnabled(CONST.BETAS.TRACK_FLOWS)) {
if (Permissions.canUseTrackFlows()) {
items.push({
key: CONST.REPORT_DETAILS_MENU_ITEM.TRACK.CATEGORIZE,
translationKey: 'actionableMentionTrackExpense.categorize',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ function PureReportActionItem({
},
];

if (isBetaEnabled(CONST.BETAS.TRACK_FLOWS)) {
if (Permissions.canUseTrackFlows()) {
options.push(
{
text: 'actionableMentionTrackExpense.categorize',
Expand Down
21 changes: 10 additions & 11 deletions tests/ui/ReportDetailsPageTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ describe('ReportDetailsPage', () => {
});

it('self DM track options should disappear when report moved to workspace', async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, as the track flow is temporarily disabled, instead of removing tests, maybe we can disable this test temporarily as well? So we can enable it again in the future

Suggested change
it('self DM track options should disappear when report moved to workspace', async () => {
xit('self DM track options should disappear when report moved to workspace', async () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this test still makes sense for the Submit it to someone option, no? We could comment the disabled options instead of removing them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, instead of disabling the whole test, comment lines also makes sense to me

await act(async () => {
await Onyx.merge(ONYXKEYS.BETAS, [CONST.BETAS.TRACK_FLOWS]);
});

const selfDMReportID = '1';
const trackExpenseReportID = '2';
const trackExpenseActionID = '123';
Expand Down Expand Up @@ -95,12 +91,13 @@ describe('ReportDetailsPage', () => {
await waitForBatchedUpdatesWithAct();

const submitText = translateLocal('actionableMentionTrackExpense.submit');
const categorizeText = translateLocal('actionableMentionTrackExpense.categorize');
const shareText = translateLocal('actionableMentionTrackExpense.share');

await screen.findByText(submitText);
await screen.findByText(categorizeText);
await screen.findByText(shareText);

// Categorize and share are temporarily disabled
// const categorizeText = translateLocal('actionableMentionTrackExpense.categorize');
// const shareText = translateLocal('actionableMentionTrackExpense.share');
// await screen.findByText(categorizeText);
// await screen.findByText(shareText);

const movedTrackExpenseReport = {
...trackExpenseReport,
Expand Down Expand Up @@ -128,7 +125,9 @@ describe('ReportDetailsPage', () => {
);

expect(screen.queryByText(submitText)).not.toBeVisible();
expect(screen.queryByText(categorizeText)).not.toBeVisible();
expect(screen.queryByText(shareText)).not.toBeVisible();

// Categorize and share are temporarily disabled
// expect(screen.queryByText(categorizeText)).not.toBeVisible();
// expect(screen.queryByText(shareText)).not.toBeVisible();
});
});