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

Define & hide any deprecated report actions from OldDot #42811

Merged
merged 8 commits into from
May 29, 2024
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 src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ const CONST = {
REIMBURSEMENT_DEQUEUED: 'REIMBURSEMENTDEQUEUED',
REIMBURSEMENT_REQUESTED: 'REIMBURSEMENTREQUESTED', // OldDot Action
REIMBURSEMENT_SETUP: 'REIMBURSEMENTSETUP', // OldDot Action
REIMBURSEMENT_SETUP_REQUESTED: 'REIMBURSEMENTSETUPREQUESTED', // OldDot Action
RENAMED: 'RENAMED',
REPORT_PREVIEW: 'REPORTPREVIEW',
SELECTED_FOR_RANDOM_AUDIT: 'SELECTEDFORRANDOMAUDIT', // OldDot Action
Expand Down
11 changes: 11 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,17 @@ function isReportActionDeprecated(reportAction: OnyxEntry<ReportAction>, key: st
return true;
}

const deprecatedOldDotReportActions: ActionName[] = [
CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT,
CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED,
CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED,
CONST.REPORT.ACTIONS.TYPE.DONATION,
];
if (deprecatedOldDotReportActions.includes(reportAction.actionName as ActionName)) {
Log.info('Front end filtered out reportAction for being an older, deprecated report action', false, reportAction);
return true;
}

return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ import * as ReportActionsUtils from './ReportActionsUtils';
import StringUtils from './StringUtils';
import * as TransactionUtils from './TransactionUtils';
import * as Url from './Url';
import type * as UserUtils from './UserUtils';
import * as UserUtils from './UserUtils';

type AvatarRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18;

Expand Down
9 changes: 8 additions & 1 deletion tests/utils/collections/reportActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,18 @@ const getRandomDate = (): string => {
return formattedDate;
};

const deprecatedReportActions: ActionName[] = [
CONST.REPORT.ACTIONS.TYPE.DELETED_ACCOUNT,
CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_REQUESTED,
CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_SETUP_REQUESTED,
CONST.REPORT.ACTIONS.TYPE.DONATION,
];

export default function createRandomReportAction(index: number): ReportAction {
return {
// we need to add any here because of the way we are generating random values
// eslint-disable-next-line @typescript-eslint/no-explicit-any
actionName: rand(flattenActionNamesValues(CONST.REPORT.ACTIONS.TYPE)) as any,
actionName: rand(flattenActionNamesValues(CONST.REPORT.ACTIONS.TYPE).filter((actionType: ActionName) => !deprecatedReportActions.includes(actionType))) as any,
reportActionID: index.toString(),
previousReportActionID: (index === 0 ? 0 : index - 1).toString(),
actorAccountID: index,
Expand Down
Loading