From 9863f542de3f64ab3c5f29d41fefb8428cf59d80 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 5 Jun 2025 09:42:22 -0600 Subject: [PATCH 01/10] deprecate getPolicy --- Mobile-Expensify | 2 +- src/components/ReportWelcomeText.tsx | 1 + src/libs/CardFeedUtils.ts | 1 + src/libs/CardMessageUtils.ts | 1 + src/libs/DistanceRequestUtils.ts | 1 + src/libs/PerDiemRequestUtils.ts | 1 + src/libs/PolicyUtils.ts | 10 ++++- src/libs/ReportActionsUtils.ts | 2 + src/libs/ReportUtils.ts | 35 +++++++++++++++-- src/libs/SearchUIUtils.ts | 1 + src/libs/SidebarUtils.ts | 1 + src/libs/TransactionUtils/index.ts | 2 + src/libs/actions/CompanyCards.ts | 1 + src/libs/actions/IOU.ts | 11 ++++++ src/libs/actions/Policy/Category.ts | 2 + src/libs/actions/Policy/Member.ts | 5 +++ src/libs/actions/Policy/Policy.ts | 38 +++++++++++++++++++ src/libs/actions/Policy/Tag.ts | 2 + src/libs/actions/Report.ts | 3 ++ src/libs/actions/TeachersUnite.ts | 1 + src/libs/actions/connections/index.ts | 1 + src/pages/ReportChangeWorkspacePage.tsx | 1 + .../WorkspaceAdminRestrictedAction.tsx | 1 + .../TransactionDuplicate/ReviewTaxCode.tsx | 1 + .../report/SystemChatReportFooterMessage.tsx | 1 + src/pages/iou/SplitExpenseEditPage.tsx | 1 + .../request/step/IOURequestStepDistance.tsx | 1 + .../step/IOURequestStepPerDiemWorkspace.tsx | 1 + src/pages/workspace/WorkspacesListPage.tsx | 1 + .../members/WorkspaceMemberNewCardPage.tsx | 1 + 30 files changed, 125 insertions(+), 6 deletions(-) diff --git a/Mobile-Expensify b/Mobile-Expensify index 3781438b15ee..ed98bbf74038 160000 --- a/Mobile-Expensify +++ b/Mobile-Expensify @@ -1 +1 @@ -Subproject commit 3781438b15ee44cce025b06e50012e77d0521ee1 +Subproject commit ed98bbf740382004f894267a9bd0c7a8096416b8 diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 626c70528e40..f1daf0ba4655 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -155,6 +155,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { {report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL ? ( {getDisplayNameForParticipant({accountID: report?.invoiceReceiver?.accountID})} ) : ( + // eslint-disable-next-line deprecation/deprecation {getPolicy(report?.invoiceReceiver?.policyID)?.name} )} diff --git a/src/libs/CardFeedUtils.ts b/src/libs/CardFeedUtils.ts index b7d3f3ca166f..d06d8e9bf6c3 100644 --- a/src/libs/CardFeedUtils.ts +++ b/src/libs/CardFeedUtils.ts @@ -165,6 +165,7 @@ function getWorkspaceCardFeedData(cardFeed: WorkspaceCardsList | undefined, repe const {domainName, bank} = representativeCard; const isBankRepeating = repeatingBanks.includes(bank); const policyID = domainName.match(CONST.REGEX.EXPENSIFY_POLICY_DOMAIN_NAME)?.[1] ?? ''; + // eslint-disable-next-line deprecation/deprecation const correspondingPolicy = getPolicy(policyID?.toUpperCase()); const cardFeedLabel = isBankRepeating ? correspondingPolicy?.name : undefined; const cardFeedBankName = bank === CONST.EXPENSIFY_CARD.BANK ? translate('search.filters.card.expensify') : getBankName(bank as CompanyCardFeed); diff --git a/src/libs/CardMessageUtils.ts b/src/libs/CardMessageUtils.ts index 168db4545c28..5443f8debe02 100644 --- a/src/libs/CardMessageUtils.ts +++ b/src/libs/CardMessageUtils.ts @@ -42,6 +42,7 @@ function getExpensifyCardFromReportAction({reportAction, policyID}: {reportActio const cardID = cardIssuedActionOriginalMessage?.cardID ?? CONST.DEFAULT_NUMBER_ID; const workspaceAccountID = getWorkspaceAccountID(policyID); const allExpensifyCards = allWorkspaceCards?.[`cards_${workspaceAccountID}_${CONST.EXPENSIFY_CARD.BANK}`] ?? {}; + // eslint-disable-next-line deprecation/deprecation return isPolicyAdmin(getPolicy(policyID)) ? allExpensifyCards?.[cardID] : allUserCards[cardID]; } diff --git a/src/libs/DistanceRequestUtils.ts b/src/libs/DistanceRequestUtils.ts index 6b2321085002..22d81baaa074 100644 --- a/src/libs/DistanceRequestUtils.ts +++ b/src/libs/DistanceRequestUtils.ts @@ -302,6 +302,7 @@ function getCustomUnitRateID(reportID?: string) { } const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`]; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID ?? parentReport?.policyID); if (isEmptyObject(policy)) { diff --git a/src/libs/PerDiemRequestUtils.ts b/src/libs/PerDiemRequestUtils.ts index 261c9cc8c4a4..4e311bcaf41c 100644 --- a/src/libs/PerDiemRequestUtils.ts +++ b/src/libs/PerDiemRequestUtils.ts @@ -27,6 +27,7 @@ Onyx.connect({ function getCustomUnitID(reportID: string) { const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`]; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID ?? parentReport?.policyID); let customUnitID: string = CONST.CUSTOM_UNITS.FAKE_P2P_ID; let category: string | undefined; diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index d08acf7e3e2f..6c38371ec7a6 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -701,6 +701,7 @@ function getAdminEmployees(policy: OnyxEntry): PolicyEmployee[] { /** * Returns the policy of the report + * @deprecated Get the data straight from Onyx */ function getPolicy(policyID: string | undefined, policies: OnyxCollection = allPolicies): OnyxEntry { if (!policies || !policyID) { @@ -738,6 +739,7 @@ function hasPolicyWithXeroConnection(currentUserLogin: string | undefined) { /** Whether the user can send invoice from the workspace */ function canSendInvoiceFromWorkspace(policyID: string | undefined): boolean { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); return policy?.areInvoicesEnabled ?? false; } @@ -1196,6 +1198,7 @@ function getCurrentTaxID(policy: OnyxEntry, taxID: string): string | und } function getWorkspaceAccountID(policyID?: string) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); if (!policy) { @@ -1205,6 +1208,7 @@ function getWorkspaceAccountID(policyID?: string) { } function hasVBBA(policyID: string | undefined) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); return !!policy?.achAccount?.bankAccountID; } @@ -1213,7 +1217,7 @@ function getTagApproverRule(policyOrID: string | SearchPolicy | OnyxEntry { + // eslint-disable-next-line deprecation/deprecation return getPolicy(activePolicyId); } @@ -1278,6 +1283,7 @@ function getGroupPaidPoliciesWithExpenseChatEnabled(policies: OnyxCollection 1; } + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); return !!policy && isPolicyAdmin(policy); @@ -1374,6 +1381,7 @@ const getDescriptionForPolicyDomainCard = (domainName: string): string => { // A domain name containing a policyID indicates that this is a workspace feed const policyID = domainName.match(CONST.REGEX.EXPENSIFY_POLICY_DOMAIN_NAME)?.[1]; if (policyID) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID.toUpperCase()); return policy?.name ?? domainName; } diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index f491057e5bdf..75af9d035c18 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2348,6 +2348,7 @@ function shouldShowAddMissingDetails(actionName?: ReportActionName, card?: Card) } function getJoinRequestMessage(reportAction: ReportAction) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(getOriginalMessage(reportAction)?.policyID); const userDetail = getPersonalDetailByEmail(getOriginalMessage(reportAction)?.email ?? ''); const userName = userDetail?.firstName ? `${userDetail.displayName} (${userDetail.login})` : (userDetail?.login ?? getOriginalMessage(reportAction)?.email); @@ -2377,6 +2378,7 @@ function getCardIssuedMessage({ const assigneeAccountID = cardIssuedActionOriginalMessage?.assigneeAccountID ?? CONST.DEFAULT_NUMBER_ID; const cardID = cardIssuedActionOriginalMessage?.cardID ?? CONST.DEFAULT_NUMBER_ID; + // eslint-disable-next-line deprecation/deprecation const isPolicyAdmin = isPolicyAdminPolicyUtils(getPolicy(policyID)); const assignee = shouldRenderHTML ? `` : Parser.htmlToText(``); const navigateRoute = isPolicyAdmin ? ROUTES.EXPENSIFY_CARD_DETAILS.getRoute(policyID, String(cardID)) : ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(String(cardID)); diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 2809cf98edb8..be481310c3ef 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1221,6 +1221,7 @@ function getRootParentReport({ /** * Returns the policy of the report + * @deprecated Get the data straight from Onyx */ function getPolicy(policyID: string | undefined): OnyxEntry { if (!allPolicies || !policyID) { @@ -1540,6 +1541,7 @@ function isCurrentUserInvoiceReceiver(report: OnyxEntry): boolean { } if (report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report.invoiceReceiver.policyID); return isPolicyAdminPolicyUtils(policy); } @@ -1779,6 +1781,7 @@ function isAwaitingFirstLevelApproval(report: OnyxEntry): boolean { return false; } + // eslint-disable-next-line deprecation/deprecation const submitsToAccountID = getSubmitToAccountID(getPolicy(report.policyID), report); return isProcessingReport(report) && submitsToAccountID === report.managerID; @@ -1991,6 +1994,7 @@ function isJoinRequestInAdminRoom(report: OnyxEntry): boolean { // Account manager/guide should not have the workspace join request pinned to their LHN, // since they are not a part of the company, and should not action it on their behalf. if (report.policyID) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report.policyID); if (!isExpensifyTeam(policy?.owner) && isExpensifyTeam(currentUserPersonalDetails?.login)) { return false; @@ -2004,6 +2008,7 @@ function isJoinRequestInAdminRoom(report: OnyxEntry): boolean { */ function isAuditor(report: OnyxEntry): boolean { if (report?.policyID) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report.policyID); return isPolicyAuditor(policy); } @@ -2336,7 +2341,7 @@ function canAddOrDeleteTransactions(moneyRequestReport: OnyxEntry, isRep if (!isMoneyRequestReport(moneyRequestReport) || isReportArchived) { return false; } - + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(moneyRequestReport?.policyID); if (isInstantSubmitEnabled(policy) && isSubmitAndClose(policy) && !arePaymentsEnabled(policy)) { @@ -2364,7 +2369,7 @@ function canAddTransaction(moneyRequestReport: OnyxEntry, isReportArchiv if (!isMoneyRequestReport(moneyRequestReport)) { return false; } - + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(moneyRequestReport?.policyID); if (isInstantSubmitEnabled(policy) && isSubmitAndClose(policy) && hasOnlyNonReimbursableTransactions(moneyRequestReport?.reportID)) { return false; @@ -2979,6 +2984,7 @@ function getIcons( icons.push(...getIconsForParticipants([report?.invoiceReceiver.accountID], personalDetails)); } else { const receiverPolicyID = report?.invoiceReceiver?.policyID; + // eslint-disable-next-line deprecation/deprecation const receiverPolicy = invoiceReceiverPolicy ?? getPolicy(receiverPolicyID); if (!isEmptyObject(receiverPolicy)) { icons.push({ @@ -3060,6 +3066,7 @@ function getIcons( } const receiverPolicyID = invoiceRoomReport?.invoiceReceiver?.policyID; + // eslint-disable-next-line deprecation/deprecation const receiverPolicy = invoiceReceiverPolicy ?? getPolicy(receiverPolicyID); if (!isEmptyObject(receiverPolicy)) { @@ -3392,6 +3399,7 @@ function getReasonAndReportActionThatRequiresAttention( const hasOnlyPendingTransactions = transactions.length > 0 && transactions.every((t) => isExpensifyCardTransaction(t) && isPending(t)); // Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(optionOrReport.policyID); if ( (optionOrReport.hasOutstandingChildRequest === true || iouReportActionToApproveOrPay?.reportActionID) && @@ -3817,7 +3825,7 @@ function canEditMoneyRequest(reportAction: OnyxInputOrEntry return false; } + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(moneyRequestReport?.policyID); const isAdmin = isExpenseReport(moneyRequestReport) && policy?.role === CONST.POLICY.ROLE.ADMIN; const isManager = isExpenseReport(moneyRequestReport) && currentUserAccountID === moneyRequestReport?.managerID; @@ -4646,6 +4655,7 @@ function getInvoicesChatName({ const isIndividual = invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL; const invoiceReceiverAccountID = isIndividual ? invoiceReceiver.accountID : CONST.DEFAULT_NUMBER_ID; const invoiceReceiverPolicyID = isIndividual ? undefined : invoiceReceiver?.policyID; + // eslint-disable-next-line deprecation/deprecation const invoiceReceiverPolicy = receiverPolicy ?? getPolicy(invoiceReceiverPolicyID); const isCurrentUserReceiver = (isIndividual && invoiceReceiverAccountID === currentUserAccountID) || (!isIndividual && isPolicyAdminPolicyUtils(invoiceReceiverPolicy)); @@ -5262,6 +5272,7 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails, mediaAt } if (parsingDetails?.policyID) { + // eslint-disable-next-line deprecation/deprecation const policyType = getPolicy(parsingDetails?.policyID)?.type; if (policyType) { isGroupPolicyReport = isGroupPolicy(policyType); @@ -5530,6 +5541,7 @@ function buildOptimisticIOUReport( const personalDetails = getPersonalDetailsForAccountID(payerAccountID); const payerEmail = 'login' in personalDetails ? personalDetails.login : ''; const policyID = chatReportID ? getReport(chatReportID, allReports)?.policyID : undefined; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const participants: Participants = { @@ -5687,6 +5699,7 @@ function buildOptimisticExpenseReport( const report = chatReportID ? getReport(chatReportID, allReports) : undefined; const policyName = getPolicyName({report}); const formattedTotal = convertToDisplayString(storedTotal, currency); + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const {stateNum, statusNum} = getExpenseReportStateAndStatus(policy); @@ -6205,7 +6218,9 @@ function buildOptimisticChangePolicyReportAction(fromPolicyID: string | undefine automaticAction, }; + // eslint-disable-next-line deprecation/deprecation const fromPolicy = getPolicy(fromPolicyID); + // eslint-disable-next-line deprecation/deprecation const toPolicy = getPolicy(toPolicyID); const changePolicyReportActionMessage = [ @@ -7184,6 +7199,7 @@ function buildOptimisticResolvedDuplicatesReportAction(): OptimisticDismissedVio function buildOptimisticAnnounceChat(policyID: string, accountIDs: number[]): OptimisticAnnounceChat { const announceReport = getRoom(CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE, policyID); + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const announceRoomOnyxData: AnnounceRoomOnyxData = { onyxOptimisticData: [], @@ -8359,6 +8375,7 @@ function getMoneyRequestOptions(report: OnyxEntry, policy: OnyxEntry 0; + // eslint-disable-next-line deprecation/deprecation const policyOwnerAccountID = getPolicy(report?.policyID)?.ownerAccountID; const isPolicyOwnedByExpensifyAccounts = policyOwnerAccountID ? CONST.EXPENSIFY_ACCOUNT_IDS.includes(policyOwnerAccountID) : false; if (doParticipantsIncludeExpensifyAccounts && !isPolicyOwnedByExpensifyAccounts) { @@ -8439,7 +8456,7 @@ function canLeaveInvoiceRoom(report: OnyxEntry): boolean { if (report?.statusNum === CONST.REPORT.STATUS_NUM.CLOSED) { return false; } - + // eslint-disable-next-line deprecation/deprecation const isSenderPolicyAdmin = getPolicy(report.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isSenderPolicyAdmin) { @@ -8450,6 +8467,7 @@ function canLeaveInvoiceRoom(report: OnyxEntry): boolean { return report?.invoiceReceiver?.accountID !== currentUserAccountID; } + // eslint-disable-next-line deprecation/deprecation const isReceiverPolicyAdmin = getPolicy(report.invoiceReceiver.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isReceiverPolicyAdmin) { @@ -8490,12 +8508,14 @@ function canLeaveRoom(report: OnyxEntry, isPolicyEmployee: boolean): boo return false; } + // eslint-disable-next-line deprecation/deprecation const isSenderPolicyAdmin = getPolicy(report?.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isSenderPolicyAdmin) { return false; } + // eslint-disable-next-line deprecation/deprecation const isReceiverPolicyAdmin = report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS ? getPolicy(report?.invoiceReceiver?.policyID)?.role === CONST.POLICY.ROLE.ADMIN : false; @@ -9417,12 +9437,14 @@ function isReportOwner(report: OnyxInputOrEntry): boolean { } function isAllowedToApproveExpenseReport(report: OnyxEntry, approverAccountID?: number, reportPolicy?: OnyxEntry | SearchPolicy): boolean { + // eslint-disable-next-line deprecation/deprecation const policy = reportPolicy ?? getPolicy(report?.policyID); const isOwner = (approverAccountID ?? currentUserAccountID) === report?.ownerAccountID; return !(policy?.preventSelfApproval && isOwner); } function isAllowedToSubmitDraftExpenseReport(report: OnyxEntry): boolean { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID); const submitToAccountID = getSubmitToAccountID(policy, report); @@ -9658,6 +9680,7 @@ function createDraftTransactionAndNavigateToParticipantSelector( const filteredPolicies = Object.values(allPolicies ?? {}).filter((policy) => shouldShowPolicy(policy, false, currentUserEmail)); if (actionName === CONST.IOU.ACTION.CATEGORIZE) { + // eslint-disable-next-line deprecation/deprecation const activePolicy = getPolicy(activePolicyID); if (activePolicy && shouldRestrictUserBillableActions(activePolicy.id)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(activePolicy.id)); @@ -9786,6 +9809,7 @@ function getOutstandingChildRequest(iouReport: OnyxInputOrEntry): Outsta }; } + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(iouReport.policyID); const shouldBeManuallySubmitted = isPaidGroupPolicyPolicyUtils(policy) && !policy?.harvesting?.enabled; if (shouldBeManuallySubmitted) { @@ -9843,6 +9867,7 @@ function prepareOnboardingOnyxData( } const integrationName = userReportedIntegration ? CONST.ONBOARDING_ACCOUNTING_MAPPING[userReportedIntegration as keyof typeof CONST.ONBOARDING_ACCOUNTING_MAPPING] : ''; + // eslint-disable-next-line deprecation/deprecation const assignedGuideEmail = getPolicy(targetChatPolicyID)?.assignedGuide?.email ?? 'Setup Specialist'; const assignedGuidePersonalDetail = Object.values(allPersonalDetails ?? {}).find((personalDetail) => personalDetail?.login === assignedGuideEmail); let assignedGuideAccountID: number; @@ -10259,6 +10284,7 @@ function prepareOnboardingOnyxData( onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.POLICY}${onboardingPolicyID}`, value: { + // eslint-disable-next-line deprecation/deprecation areConnectionsEnabled: getPolicy(onboardingPolicyID)?.areConnectionsEnabled, pendingFields: { areConnectionsEnabled: null, @@ -10639,6 +10665,7 @@ function hasMissingInvoiceBankAccount(iouReportID: string | undefined): boolean return false; } + // eslint-disable-next-line deprecation/deprecation return invoiceReport?.ownerAccountID === currentUserAccountID && !getPolicy(invoiceReport?.policyID)?.invoice?.bankAccount?.transferBankAccountID && isSettled(iouReportID); } diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index e2013f6193aa..326380065a64 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -647,6 +647,7 @@ function getTaskSections(data: OnyxTypes.SearchResults['data']): TaskListItemTyp }; if (parentReport && personalDetails) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(parentReport.policyID); const parentReportName = getReportName(parentReport, policy, undefined, undefined); const icons = getIcons(parentReport, personalDetails, null, '', -1, policy); diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 0001cb0a3814..7c14874738d4 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -812,6 +812,7 @@ function getRoomWelcomeMessage(report: OnyxEntry, isReportArchived = fal welcomeMessage.showReportName = false; welcomeMessage.phrase1 = translateLocal('reportActionsView.beginningOfChatHistoryInvoiceRoomPartOne'); welcomeMessage.phrase2 = translateLocal('reportActionsView.beginningOfChatHistoryInvoiceRoomPartTwo'); + // eslint-disable-next-line deprecation/deprecation const payer = report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL ? getDisplayNameForParticipant({accountID: report?.invoiceReceiver?.accountID}) diff --git a/src/libs/TransactionUtils/index.ts b/src/libs/TransactionUtils/index.ts index c0f3ab3db54c..5907a6883dd0 100644 --- a/src/libs/TransactionUtils/index.ts +++ b/src/libs/TransactionUtils/index.ts @@ -659,6 +659,7 @@ function isFetchingWaypointsFromServer(transaction: OnyxInputOrEntry, policyParam: OnyxEntry = undefined): string { if (transaction && isDistanceRequest(transaction)) { const report = getReportOrDraftReport(transaction.reportID); + // eslint-disable-next-line deprecation/deprecation const policy = policyParam ?? getPolicy(report?.policyID); const mileageRate = DistanceRequestUtils.getRate({transaction, policy}); const {unit, rate} = mileageRate; @@ -1409,6 +1410,7 @@ function compareDuplicateTransactionFields( const firstTransaction = transactions.at(0); const isFirstTransactionCommentEmptyObject = typeof firstTransaction?.comment === 'object' && firstTransaction?.comment?.comment === ''; const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID); const areAllFieldsEqualForKey = areAllFieldsEqual(transactions, (item) => keys.map((key) => item?.[key]).join('|')); diff --git a/src/libs/actions/CompanyCards.ts b/src/libs/actions/CompanyCards.ts index 981e5203cffc..e76ed2deea9c 100644 --- a/src/libs/actions/CompanyCards.ts +++ b/src/libs/actions/CompanyCards.ts @@ -305,6 +305,7 @@ function assignWorkspaceCompanyCard(policyID: string, data?: Partial, policyId?: string) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyId); if (!policy?.achAccount?.bankAccountID) { return false; @@ -8750,6 +8753,7 @@ function getPayMoneyRequestParams( payAsBusiness?: boolean, ): PayMoneyRequestData { const isInvoiceReport = isInvoiceReportReportUtils(iouReport); + // eslint-disable-next-line deprecation/deprecation const activePolicy = getPolicy(activePolicyID); let payerPolicyID = activePolicyID; let chatReport = initialChatReport; @@ -9143,6 +9147,7 @@ function canIOUBePaid( if (chatReport?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL) { return chatReport?.invoiceReceiver?.accountID === userAccountID; } + // eslint-disable-next-line deprecation/deprecation return (invoiceReceiverPolicy ?? getPolicy(chatReport?.invoiceReceiver?.policyID))?.role === CONST.POLICY.ROLE.ADMIN; } @@ -9215,6 +9220,7 @@ function getIOUReportActionToApproveOrPay(chatReport: OnyxEntry, isUnapproved = false) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID); const approvalChain = getApprovalChain(policy, report); const submitToAccountID = getSubmitToAccountID(policy, report); @@ -9276,6 +9283,7 @@ function approveMoneyRequest(expenseReport: OnyxEntry, full?: } const optimisticApprovedReportAction = buildOptimisticApprovedReportAction(total, expenseReport.currency ?? '', expenseReport.reportID); + // eslint-disable-next-line deprecation/deprecation const approvalChain = getApprovalChain(getPolicy(expenseReport.policyID), expenseReport); const predictedNextStatus = isLastApprover(approvalChain) ? CONST.REPORT.STATUS_NUM.APPROVED : CONST.REPORT.STATUS_NUM.SUBMITTED; @@ -9829,6 +9837,7 @@ function submitReport(expenseReport?: OnyxTypes.Report) { const currentNextStep = allNextSteps[`${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`] ?? null; const parentReport = getReportOrDraftReport(expenseReport.parentReportID); + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(expenseReport.policyID); const isCurrentUserManager = currentUserPersonalDetails?.accountID === expenseReport.managerID; const isSubmitAndClosePolicy = isSubmitAndClose(policy); @@ -9964,6 +9973,7 @@ function cancelPayment(expenseReport: OnyxEntry, chatReport: O -((expenseReport.total ?? 0) - (expenseReport?.nonReimbursableTotal ?? 0)), expenseReport.currency ?? '', ); + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(chatReport.policyID); const approvalMode = policy?.approvalMode ?? CONST.POLICY.APPROVAL_MODE.BASIC; const stateNum: ValueOf = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.APPROVED; @@ -11838,6 +11848,7 @@ function saveSplitTransactions(draftTransaction: OnyxEntry, employeeAccountID: number) { /** * Returns the policy of the report + * @deprecated Get the data straight from Onyx */ function getPolicy(policyID: string | undefined): OnyxEntry { if (!allPolicies || !policyID) { @@ -324,6 +325,7 @@ function removeOptimisticRoomMembers( * @param [loginList] The logins of the users whose roles are being updated to non-admin role or are removed from a workspace */ function resetAccountingPreferredExporter(policyID: string, loginList: string[]): OnyxDataReturnType { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const owner = policy?.owner ?? ReportUtils.getPersonalDetailsForAccountID(policy?.ownerAccountID).login ?? ''; const optimisticData: OnyxUpdate[] = []; @@ -419,6 +421,7 @@ function removeMembers(accountIDs: number[], policyID: string) { } const policyKey = `${ONYXKEYS.COLLECTION.POLICY}${policyID}` as const; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const workspaceChats = ReportUtils.getWorkspaceChats(policyID, accountIDs); @@ -781,6 +784,7 @@ function updateWorkspaceMembersRole(policyID: string, accountIDs: number[], newR } function requestWorkspaceOwnerChange(policyID: string) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const ownershipChecks = {...policyOwnershipChecks?.[policyID]}; @@ -989,6 +993,7 @@ type PolicyMember = { }; function importPolicyMembers(policyID: string, members: PolicyMember[]) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const {added, updated} = members.reduce( (acc, curr) => { diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 9092583d9ba2..68e2cb658745 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -263,6 +263,7 @@ function isCurrencySupportedForGlobalReimbursement(currency: TupleToUnion { if (!allPolicies || !policyID) { @@ -348,6 +349,7 @@ function deleteWorkspace(policyID: string, policyName: string) { : []), ]; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); // Restore the old report stateNum and statusNum const failureData: OnyxUpdate[] = [ @@ -474,6 +476,7 @@ function deleteWorkspace(policyID: string, policyName: string) { } function setWorkspaceAutoReportingFrequency(policyID: string, frequency: ValueOf) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const wasPolicyOnManualReporting = PolicyUtils.getCorrectedAutoReportingFrequency(policy) === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL; @@ -535,6 +538,7 @@ function setWorkspaceAutoReportingFrequency(policyID: string, frequency: ValueOf function setWorkspaceAutoReportingMonthlyOffset(policyID: string, autoReportingOffset: number | ValueOf) { const value = JSON.stringify({autoReportingOffset}); + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ @@ -575,6 +579,7 @@ function setWorkspaceAutoReportingMonthlyOffset(policyID: string, autoReportingO } function setWorkspaceApprovalMode(policyID: string, approver: string, approvalMode: ValueOf) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const value = { @@ -628,6 +633,7 @@ function setWorkspaceApprovalMode(policyID: string, approver: string, approvalMo } function setWorkspacePayer(policyID: string, reimburserEmail: string) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ @@ -743,6 +749,7 @@ function clearQuickbooksOnlineAutoSyncErrorField(policyID: string | undefined) { } function setWorkspaceReimbursement(policyID: string, reimbursementChoice: ValueOf, reimburserEmail: string) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ @@ -1260,6 +1267,7 @@ function updateWorkspaceAvatar(policyID: string, file: File) { * Deletes the avatar image for the workspace */ function deleteWorkspaceAvatar(policyID: string) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ { @@ -2453,6 +2461,7 @@ function requestExpensifyCardLimitIncrease(settlementBankAccountID?: number) { function updateMemberCustomField(policyID: string, login: string, customFieldType: CustomFieldType, value: string) { const customFieldKey = CONST.CUSTOM_FIELD_KEYS[customFieldType]; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const previousValue = policy?.employeeList?.[login]?.[customFieldKey]; @@ -3232,6 +3241,7 @@ function enablePolicyTaxes(policyID: string, enabled: boolean) { }, ], }; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const shouldAddDefaultTaxRatesData = (!policy?.taxRates || isEmptyObject(policy.taxRates)) && enabled; @@ -3300,6 +3310,7 @@ function enablePolicyTaxes(policyID: string, enabled: boolean) { } function enablePolicyWorkflows(policyID: string, enabled: boolean) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const onyxData: OnyxData = { optimisticData: [ @@ -3409,6 +3420,7 @@ const DISABLED_MAX_EXPENSE_VALUES: Pick, reportID: strin } function createNewReport(creatorPersonalDetails: PersonalDetails, policyID?: string, shouldNotifyNewAction = false) { + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const optimisticReportID = generateReportID(); const reportActionID = rand64(); @@ -4929,6 +4930,7 @@ function deleteAppReport(reportID: string | undefined) { */ function moveIOUReportToPolicy(reportID: string, policyID: string) { const iouReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); // This flow only works for IOU reports @@ -5097,6 +5099,7 @@ function moveIOUReportToPolicy(reportID: string, policyID: string) { */ function moveIOUReportToPolicyAndInviteSubmitter(reportID: string, policyID: string) { const iouReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); if (!policy || !iouReport) { diff --git a/src/libs/actions/TeachersUnite.ts b/src/libs/actions/TeachersUnite.ts index ed78a7c60ad8..5c534d00f29a 100644 --- a/src/libs/actions/TeachersUnite.ts +++ b/src/libs/actions/TeachersUnite.ts @@ -116,6 +116,7 @@ function addSchoolPrincipal(firstName: string, partnerUserID: string, lastName: name: policyName, role: CONST.POLICY.ROLE.USER, owner: sessionEmail, + // eslint-disable-next-line deprecation/deprecation outputCurrency: getPolicy(policyID)?.outputCurrency ?? allPersonalDetails?.[sessionAccountID]?.localCurrencyCode ?? CONST.CURRENCY.USD, employeeList: { [sessionEmail]: { diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts index 212bdc4d9e92..3ee5b6fbff5f 100644 --- a/src/libs/actions/connections/index.ts +++ b/src/libs/actions/connections/index.ts @@ -34,6 +34,7 @@ function removePolicyConnection(policyID: string, connectionName: PolicyConnecti const successData: OnyxUpdate[] = []; const failureData: OnyxUpdate[] = []; + // eslint-disable-next-line deprecation/deprecation const policy = PolicyUtils.getPolicy(policyID); const supportedConnections: PolicyConnectionName[] = [CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.POLICY.CONNECTIONS.NAME.XERO]; diff --git a/src/pages/ReportChangeWorkspacePage.tsx b/src/pages/ReportChangeWorkspacePage.tsx index 1e7dac0d7d44..49458ca662d2 100644 --- a/src/pages/ReportChangeWorkspacePage.tsx +++ b/src/pages/ReportChangeWorkspacePage.tsx @@ -45,6 +45,7 @@ function ReportChangeWorkspacePage({report}: ReportChangeWorkspacePageProps) { return; } Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(reportID)); + // eslint-disable-next-line deprecation/deprecation if (isIOUReport(reportID) && isPolicyAdmin(getPolicy(policyID)) && report.ownerAccountID && !isPolicyMember(getLoginByAccountID(report.ownerAccountID), policyID)) { moveIOUReportToPolicyAndInviteSubmitter(reportID, policyID); } else if (isIOUReport(reportID) && isPolicyMember(session?.email, policyID)) { diff --git a/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx b/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx index 342cd4ce5e6e..7142432c4f72 100644 --- a/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx +++ b/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx @@ -25,6 +25,7 @@ function WorkspaceAdminRestrictedAction({policyID}: WorkspaceAdminRestrictedActi const styles = useThemeStyles(); const openAdminsReport = useCallback(() => { + // eslint-disable-next-line deprecation/deprecation const reportID = `${PolicyUtils.getPolicy(policyID)?.chatReportIDAdmins}` ?? '-1'; Navigation.closeRHPFlow(); Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); diff --git a/src/pages/TransactionDuplicate/ReviewTaxCode.tsx b/src/pages/TransactionDuplicate/ReviewTaxCode.tsx index 4dee904b667c..907242805911 100644 --- a/src/pages/TransactionDuplicate/ReviewTaxCode.tsx +++ b/src/pages/TransactionDuplicate/ReviewTaxCode.tsx @@ -22,6 +22,7 @@ function ReviewTaxRate() { const {translate} = useLocalize(); const [reviewDuplicates] = useOnyx(ONYXKEYS.REVIEW_DUPLICATES); const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reviewDuplicates?.reportID ?? route.params.threadReportID}`); + // eslint-disable-next-line deprecation/deprecation const policy = PolicyUtils.getPolicy(report?.policyID ?? ''); const transactionID = TransactionUtils.getTransactionID(route.params.threadReportID ?? ''); const compareResult = TransactionUtils.compareDuplicateTransactionFields(transactionID, reviewDuplicates?.reportID ?? '-1'); diff --git a/src/pages/home/report/SystemChatReportFooterMessage.tsx b/src/pages/home/report/SystemChatReportFooterMessage.tsx index a000550751e3..fae0a338954d 100644 --- a/src/pages/home/report/SystemChatReportFooterMessage.tsx +++ b/src/pages/home/report/SystemChatReportFooterMessage.tsx @@ -22,6 +22,7 @@ function SystemChatReportFooterMessage() { const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const adminChatReportID = useMemo(() => { + // eslint-disable-next-line deprecation/deprecation const adminPolicy = activePolicyID ? PolicyUtils.getPolicy(activePolicyID) : Object.values(policies ?? {}).find( diff --git a/src/pages/iou/SplitExpenseEditPage.tsx b/src/pages/iou/SplitExpenseEditPage.tsx index 93795525ddb1..d5f24724aed6 100644 --- a/src/pages/iou/SplitExpenseEditPage.tsx +++ b/src/pages/iou/SplitExpenseEditPage.tsx @@ -38,6 +38,7 @@ function SplitExpenseEditPage({route}: SplitExpensePageProps) { const [splitExpenseDraftTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, {canBeMissing: false}); const splitExpenseDraftTransactionDetails = useMemo>(() => getTransactionDetails(splitExpenseDraftTransaction) ?? {}, [splitExpenseDraftTransaction]); + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID); const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report?.policyID}`, {canBeMissing: false}); const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${report?.policyID}`, {canBeMissing: false}); diff --git a/src/pages/iou/request/step/IOURequestStepDistance.tsx b/src/pages/iou/request/step/IOURequestStepDistance.tsx index 94972d3f597c..fc5fccc5ecb8 100644 --- a/src/pages/iou/request/step/IOURequestStepDistance.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistance.tsx @@ -148,6 +148,7 @@ function IOURequestStepDistance({ const policyReport = participants.at(0) ? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${selectedReportID}`] : report; const IOUpolicyID = getIOURequestPolicyID(transaction, policyReport); + // eslint-disable-next-line deprecation/deprecation const IOUpolicy = getPolicy(report?.policyID ?? IOUpolicyID); const policyCurrency = policy?.outputCurrency ?? getPersonalPolicy()?.outputCurrency ?? CONST.CURRENCY.USD; diff --git a/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx b/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx index 70d974d8213c..0afaa0618cc7 100644 --- a/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx +++ b/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx @@ -64,6 +64,7 @@ function IOURequestStepPerDiemWorkspace({ if (!policyExpenseReportID) { return; } + // eslint-disable-next-line deprecation/deprecation const selectedPolicy = getPolicy(item.value, allPolicies); const perDiemUnit = getPerDiemCustomUnit(selectedPolicy); setMoneyRequestParticipants(transactionID, [ diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index 67c1371a3ec1..c9a5cebb7e8d 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -146,6 +146,7 @@ function WorkspacesListPage() { selector: filterInactiveCards, canBeMissing: true, }); + // eslint-disable-next-line deprecation/deprecation const policyToDelete = getPolicy(policyIDToDelete); const hasCardFeedOrExpensifyCard = !isEmptyObject(cardFeeds) || diff --git a/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx b/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx index c4595ab5a588..9b8367382e3e 100644 --- a/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx +++ b/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx @@ -51,6 +51,7 @@ type WorkspaceMemberNewCardPageProps = WithPolicyAndFullscreenLoadingProps & Pla function WorkspaceMemberNewCardPage({route, personalDetails}: WorkspaceMemberNewCardPageProps) { const {policyID} = route.params; + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const workspaceAccountID = policy?.workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID; From 71b93cffb4a1e2d1579740607105f3ef20e74458 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 5 Jun 2025 09:45:08 -0600 Subject: [PATCH 02/10] rm submodule change --- Mobile-Expensify | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mobile-Expensify b/Mobile-Expensify index ed98bbf74038..3781438b15ee 160000 --- a/Mobile-Expensify +++ b/Mobile-Expensify @@ -1 +1 @@ -Subproject commit ed98bbf740382004f894267a9bd0c7a8096416b8 +Subproject commit 3781438b15ee44cce025b06e50012e77d0521ee1 From 403dece6cd4cb983e4195c84c5d9e2f463e82338 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 5 Jun 2025 10:00:24 -0600 Subject: [PATCH 03/10] add missing disables --- src/libs/PolicyUtils.ts | 1 + src/libs/ReportUtils.ts | 2 +- src/libs/SidebarUtils.ts | 4 ++-- src/pages/home/report/SystemChatReportFooterMessage.tsx | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 6c38371ec7a6..df68e03043d1 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -1426,6 +1426,7 @@ export { getNumericValue, isMultiLevelTags, getPersonalPolicy, + // eslint-disable-next-line deprecation/deprecation getPolicy, getPolicyBrickRoadIndicatorStatus, getPolicyEmployeeListByIdWithoutCurrentUser, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index be481310c3ef..9ce2a069ca32 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -8515,8 +8515,8 @@ function canLeaveRoom(report: OnyxEntry, isPolicyEmployee: boolean): boo return false; } - // eslint-disable-next-line deprecation/deprecation const isReceiverPolicyAdmin = + // eslint-disable-next-line deprecation/deprecation report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS ? getPolicy(report?.invoiceReceiver?.policyID)?.role === CONST.POLICY.ROLE.ADMIN : false; if (isReceiverPolicyAdmin) { diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 7c14874738d4..2eafa42ddcaf 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -812,11 +812,11 @@ function getRoomWelcomeMessage(report: OnyxEntry, isReportArchived = fal welcomeMessage.showReportName = false; welcomeMessage.phrase1 = translateLocal('reportActionsView.beginningOfChatHistoryInvoiceRoomPartOne'); welcomeMessage.phrase2 = translateLocal('reportActionsView.beginningOfChatHistoryInvoiceRoomPartTwo'); - // eslint-disable-next-line deprecation/deprecation const payer = report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL ? getDisplayNameForParticipant({accountID: report?.invoiceReceiver?.accountID}) - : getPolicy(report?.invoiceReceiver?.policyID)?.name; + : // eslint-disable-next-line deprecation/deprecation + getPolicy(report?.invoiceReceiver?.policyID)?.name; const receiver = getPolicyName({report}); welcomeMessage.messageText = `${welcomeMessage.phrase1}${payer} ${translateLocal('common.and')} ${receiver}${welcomeMessage.phrase2}`; return welcomeMessage; diff --git a/src/pages/home/report/SystemChatReportFooterMessage.tsx b/src/pages/home/report/SystemChatReportFooterMessage.tsx index fae0a338954d..eaa25e7e61e4 100644 --- a/src/pages/home/report/SystemChatReportFooterMessage.tsx +++ b/src/pages/home/report/SystemChatReportFooterMessage.tsx @@ -22,8 +22,8 @@ function SystemChatReportFooterMessage() { const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); const adminChatReportID = useMemo(() => { - // eslint-disable-next-line deprecation/deprecation const adminPolicy = activePolicyID + // eslint-disable-next-line deprecation/deprecation ? PolicyUtils.getPolicy(activePolicyID) : Object.values(policies ?? {}).find( (policy) => PolicyUtils.shouldShowPolicy(policy, false, currentUserLogin) && policy?.role === CONST.POLICY.ROLE.ADMIN && policy?.chatReportIDAdmins, From 1d741b59d688e218546fec4c3cf84c9215c9a1ab Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 5 Jun 2025 10:06:00 -0600 Subject: [PATCH 04/10] fix lint --- src/libs/ReportUtils.ts | 2 +- src/pages/home/report/SystemChatReportFooterMessage.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 9ce2a069ca32..b156fa59ec11 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -8516,7 +8516,7 @@ function canLeaveRoom(report: OnyxEntry, isPolicyEmployee: boolean): boo } const isReceiverPolicyAdmin = - // eslint-disable-next-line deprecation/deprecation + // eslint-disable-next-line deprecation/deprecation report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS ? getPolicy(report?.invoiceReceiver?.policyID)?.role === CONST.POLICY.ROLE.ADMIN : false; if (isReceiverPolicyAdmin) { diff --git a/src/pages/home/report/SystemChatReportFooterMessage.tsx b/src/pages/home/report/SystemChatReportFooterMessage.tsx index eaa25e7e61e4..0918f8ed0b4e 100644 --- a/src/pages/home/report/SystemChatReportFooterMessage.tsx +++ b/src/pages/home/report/SystemChatReportFooterMessage.tsx @@ -23,8 +23,8 @@ function SystemChatReportFooterMessage() { const adminChatReportID = useMemo(() => { const adminPolicy = activePolicyID - // eslint-disable-next-line deprecation/deprecation - ? PolicyUtils.getPolicy(activePolicyID) + ? // eslint-disable-next-line deprecation/deprecation + PolicyUtils.getPolicy(activePolicyID) : Object.values(policies ?? {}).find( (policy) => PolicyUtils.shouldShowPolicy(policy, false, currentUserLogin) && policy?.role === CONST.POLICY.ROLE.ADMIN && policy?.chatReportIDAdmins, ); From c7b459f737e6b8256cee1687748be7f81d5ed612 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 6 Jun 2025 09:17:26 -0600 Subject: [PATCH 05/10] update comment --- src/libs/PolicyUtils.ts | 2 +- src/libs/ReportUtils.ts | 2 +- src/libs/actions/Policy/Member.ts | 2 +- src/libs/actions/Policy/Policy.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index df68e03043d1..62f1f1857602 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -701,7 +701,7 @@ function getAdminEmployees(policy: OnyxEntry): PolicyEmployee[] { /** * Returns the policy of the report - * @deprecated Get the data straight from Onyx + * @deprecated Get the data straight from Onyx - This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 */ function getPolicy(policyID: string | undefined, policies: OnyxCollection = allPolicies): OnyxEntry { if (!policies || !policyID) { diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index b156fa59ec11..eb68fbfb0186 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1221,7 +1221,7 @@ function getRootParentReport({ /** * Returns the policy of the report - * @deprecated Get the data straight from Onyx + * @deprecated Get the data straight from Onyx - This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 */ function getPolicy(policyID: string | undefined): OnyxEntry { if (!allPolicies || !policyID) { diff --git a/src/libs/actions/Policy/Member.ts b/src/libs/actions/Policy/Member.ts index e5c1ed058a01..7b8adca40c39 100644 --- a/src/libs/actions/Policy/Member.ts +++ b/src/libs/actions/Policy/Member.ts @@ -125,7 +125,7 @@ function isApprover(policy: OnyxEntry, employeeAccountID: number) { /** * Returns the policy of the report - * @deprecated Get the data straight from Onyx + * @deprecated Get the data straight from Onyx - This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 */ function getPolicy(policyID: string | undefined): OnyxEntry { if (!allPolicies || !policyID) { diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 68e2cb658745..b0a2bace5154 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -263,7 +263,7 @@ function isCurrencySupportedForGlobalReimbursement(currency: TupleToUnion { if (!allPolicies || !policyID) { From e75c0f4f3b3e56986f1ec5b6fc9d1d43a3f5ac1e Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 6 Jun 2025 09:58:25 -0600 Subject: [PATCH 06/10] add comment --- src/components/ReportWelcomeText.tsx | 1 + src/libs/CardFeedUtils.ts | 1 + src/libs/CardMessageUtils.ts | 1 + src/libs/DistanceRequestUtils.ts | 1 + src/libs/PerDiemRequestUtils.ts | 1 + src/libs/PolicyUtils.ts | 9 +++++ src/libs/ReportActionsUtils.ts | 2 + src/libs/ReportUtils.ts | 30 +++++++++++++++ src/libs/SearchUIUtils.ts | 1 + src/libs/SidebarUtils.ts | 1 + src/libs/TransactionUtils/index.ts | 2 + src/libs/actions/CompanyCards.ts | 1 + src/libs/actions/IOU.ts | 11 ++++++ src/libs/actions/Policy/Category.ts | 2 + src/libs/actions/Policy/Member.ts | 4 ++ src/libs/actions/Policy/Policy.ts | 37 +++++++++++++++++++ src/libs/actions/Policy/Tag.ts | 2 + src/libs/actions/Report.ts | 3 ++ src/libs/actions/TeachersUnite.ts | 1 + src/libs/actions/connections/index.ts | 1 + src/pages/ReportChangeWorkspacePage.tsx | 1 + .../WorkspaceAdminRestrictedAction.tsx | 1 + .../TransactionDuplicate/ReviewTaxCode.tsx | 1 + .../report/SystemChatReportFooterMessage.tsx | 1 + src/pages/iou/SplitExpenseEditPage.tsx | 1 + .../request/step/IOURequestStepDistance.tsx | 1 + .../step/IOURequestStepPerDiemWorkspace.tsx | 1 + src/pages/workspace/WorkspacesListPage.tsx | 1 + .../members/WorkspaceMemberNewCardPage.tsx | 1 + 29 files changed, 121 insertions(+) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index f1daf0ba4655..5f555de81a86 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -156,6 +156,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { {getDisplayNameForParticipant({accountID: report?.invoiceReceiver?.accountID})} ) : ( // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 {getPolicy(report?.invoiceReceiver?.policyID)?.name} )} diff --git a/src/libs/CardFeedUtils.ts b/src/libs/CardFeedUtils.ts index d06d8e9bf6c3..b84cee44fb87 100644 --- a/src/libs/CardFeedUtils.ts +++ b/src/libs/CardFeedUtils.ts @@ -166,6 +166,7 @@ function getWorkspaceCardFeedData(cardFeed: WorkspaceCardsList | undefined, repe const isBankRepeating = repeatingBanks.includes(bank); const policyID = domainName.match(CONST.REGEX.EXPENSIFY_POLICY_DOMAIN_NAME)?.[1] ?? ''; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const correspondingPolicy = getPolicy(policyID?.toUpperCase()); const cardFeedLabel = isBankRepeating ? correspondingPolicy?.name : undefined; const cardFeedBankName = bank === CONST.EXPENSIFY_CARD.BANK ? translate('search.filters.card.expensify') : getBankName(bank as CompanyCardFeed); diff --git a/src/libs/CardMessageUtils.ts b/src/libs/CardMessageUtils.ts index 5443f8debe02..60e6ced396c1 100644 --- a/src/libs/CardMessageUtils.ts +++ b/src/libs/CardMessageUtils.ts @@ -43,6 +43,7 @@ function getExpensifyCardFromReportAction({reportAction, policyID}: {reportActio const workspaceAccountID = getWorkspaceAccountID(policyID); const allExpensifyCards = allWorkspaceCards?.[`cards_${workspaceAccountID}_${CONST.EXPENSIFY_CARD.BANK}`] ?? {}; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 return isPolicyAdmin(getPolicy(policyID)) ? allExpensifyCards?.[cardID] : allUserCards[cardID]; } diff --git a/src/libs/DistanceRequestUtils.ts b/src/libs/DistanceRequestUtils.ts index 22d81baaa074..108f2aa9c64a 100644 --- a/src/libs/DistanceRequestUtils.ts +++ b/src/libs/DistanceRequestUtils.ts @@ -303,6 +303,7 @@ function getCustomUnitRateID(reportID?: string) { const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`]; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(report?.policyID ?? parentReport?.policyID); if (isEmptyObject(policy)) { diff --git a/src/libs/PerDiemRequestUtils.ts b/src/libs/PerDiemRequestUtils.ts index 4e311bcaf41c..870f5599f20b 100644 --- a/src/libs/PerDiemRequestUtils.ts +++ b/src/libs/PerDiemRequestUtils.ts @@ -28,6 +28,7 @@ function getCustomUnitID(reportID: string) { const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`]; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(report?.policyID ?? parentReport?.policyID); let customUnitID: string = CONST.CUSTOM_UNITS.FAKE_P2P_ID; let category: string | undefined; diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 62f1f1857602..2668a2683c3e 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -740,6 +740,7 @@ function hasPolicyWithXeroConnection(currentUserLogin: string | undefined) { /** Whether the user can send invoice from the workspace */ function canSendInvoiceFromWorkspace(policyID: string | undefined): boolean { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); return policy?.areInvoicesEnabled ?? false; } @@ -1199,6 +1200,7 @@ function getCurrentTaxID(policy: OnyxEntry, taxID: string): string | und function getWorkspaceAccountID(policyID?: string) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); if (!policy) { @@ -1209,6 +1211,7 @@ function getWorkspaceAccountID(policyID?: string) { function hasVBBA(policyID: string | undefined) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); return !!policy?.achAccount?.bankAccountID; } @@ -1218,6 +1221,7 @@ function getTagApproverRule(policyOrID: string | SearchPolicy | OnyxEntry { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 return getPolicy(activePolicyId); } @@ -1284,6 +1289,7 @@ function getGroupPaidPoliciesWithExpenseChatEnabled(policies: OnyxCollection 1; } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); return !!policy && isPolicyAdmin(policy); @@ -1382,6 +1389,7 @@ const getDescriptionForPolicyDomainCard = (domainName: string): string => { const policyID = domainName.match(CONST.REGEX.EXPENSIFY_POLICY_DOMAIN_NAME)?.[1]; if (policyID) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID.toUpperCase()); return policy?.name ?? domainName; } @@ -1427,6 +1435,7 @@ export { isMultiLevelTags, getPersonalPolicy, // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 getPolicy, getPolicyBrickRoadIndicatorStatus, getPolicyEmployeeListByIdWithoutCurrentUser, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 75af9d035c18..0c0378b9f634 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2349,6 +2349,7 @@ function shouldShowAddMissingDetails(actionName?: ReportActionName, card?: Card) function getJoinRequestMessage(reportAction: ReportAction) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(getOriginalMessage(reportAction)?.policyID); const userDetail = getPersonalDetailByEmail(getOriginalMessage(reportAction)?.email ?? ''); const userName = userDetail?.firstName ? `${userDetail.displayName} (${userDetail.login})` : (userDetail?.login ?? getOriginalMessage(reportAction)?.email); @@ -2379,6 +2380,7 @@ function getCardIssuedMessage({ const assigneeAccountID = cardIssuedActionOriginalMessage?.assigneeAccountID ?? CONST.DEFAULT_NUMBER_ID; const cardID = cardIssuedActionOriginalMessage?.cardID ?? CONST.DEFAULT_NUMBER_ID; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const isPolicyAdmin = isPolicyAdminPolicyUtils(getPolicy(policyID)); const assignee = shouldRenderHTML ? `` : Parser.htmlToText(``); const navigateRoute = isPolicyAdmin ? ROUTES.EXPENSIFY_CARD_DETAILS.getRoute(policyID, String(cardID)) : ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(String(cardID)); diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index eb68fbfb0186..29a1a37df076 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1542,6 +1542,7 @@ function isCurrentUserInvoiceReceiver(report: OnyxEntry): boolean { if (report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(report.invoiceReceiver.policyID); return isPolicyAdminPolicyUtils(policy); } @@ -1782,6 +1783,7 @@ function isAwaitingFirstLevelApproval(report: OnyxEntry): boolean { } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const submitsToAccountID = getSubmitToAccountID(getPolicy(report.policyID), report); return isProcessingReport(report) && submitsToAccountID === report.managerID; @@ -1995,6 +1997,7 @@ function isJoinRequestInAdminRoom(report: OnyxEntry): boolean { // since they are not a part of the company, and should not action it on their behalf. if (report.policyID) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(report.policyID); if (!isExpensifyTeam(policy?.owner) && isExpensifyTeam(currentUserPersonalDetails?.login)) { return false; @@ -2009,6 +2012,7 @@ function isJoinRequestInAdminRoom(report: OnyxEntry): boolean { function isAuditor(report: OnyxEntry): boolean { if (report?.policyID) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(report.policyID); return isPolicyAuditor(policy); } @@ -2342,6 +2346,7 @@ function canAddOrDeleteTransactions(moneyRequestReport: OnyxEntry, isRep return false; } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(moneyRequestReport?.policyID); if (isInstantSubmitEnabled(policy) && isSubmitAndClose(policy) && !arePaymentsEnabled(policy)) { @@ -2370,6 +2375,7 @@ function canAddTransaction(moneyRequestReport: OnyxEntry, isReportArchiv return false; } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(moneyRequestReport?.policyID); if (isInstantSubmitEnabled(policy) && isSubmitAndClose(policy) && hasOnlyNonReimbursableTransactions(moneyRequestReport?.reportID)) { return false; @@ -2985,6 +2991,7 @@ function getIcons( } else { const receiverPolicyID = report?.invoiceReceiver?.policyID; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const receiverPolicy = invoiceReceiverPolicy ?? getPolicy(receiverPolicyID); if (!isEmptyObject(receiverPolicy)) { icons.push({ @@ -3067,6 +3074,7 @@ function getIcons( const receiverPolicyID = invoiceRoomReport?.invoiceReceiver?.policyID; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const receiverPolicy = invoiceReceiverPolicy ?? getPolicy(receiverPolicyID); if (!isEmptyObject(receiverPolicy)) { @@ -3400,6 +3408,7 @@ function getReasonAndReportActionThatRequiresAttention( // Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(optionOrReport.policyID); if ( (optionOrReport.hasOutstandingChildRequest === true || iouReportActionToApproveOrPay?.reportActionID) && @@ -3826,6 +3835,7 @@ function canEditMoneyRequest(reportAction: OnyxInputOrEntry } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(moneyRequestReport?.policyID); const isAdmin = isExpenseReport(moneyRequestReport) && policy?.role === CONST.POLICY.ROLE.ADMIN; const isManager = isExpenseReport(moneyRequestReport) && currentUserAccountID === moneyRequestReport?.managerID; @@ -4656,6 +4667,7 @@ function getInvoicesChatName({ const invoiceReceiverAccountID = isIndividual ? invoiceReceiver.accountID : CONST.DEFAULT_NUMBER_ID; const invoiceReceiverPolicyID = isIndividual ? undefined : invoiceReceiver?.policyID; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const invoiceReceiverPolicy = receiverPolicy ?? getPolicy(invoiceReceiverPolicyID); const isCurrentUserReceiver = (isIndividual && invoiceReceiverAccountID === currentUserAccountID) || (!isIndividual && isPolicyAdminPolicyUtils(invoiceReceiverPolicy)); @@ -5273,6 +5285,7 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails, mediaAt if (parsingDetails?.policyID) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policyType = getPolicy(parsingDetails?.policyID)?.type; if (policyType) { isGroupPolicyReport = isGroupPolicy(policyType); @@ -5542,6 +5555,7 @@ function buildOptimisticIOUReport( const payerEmail = 'login' in personalDetails ? personalDetails.login : ''; const policyID = chatReportID ? getReport(chatReportID, allReports)?.policyID : undefined; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const participants: Participants = { @@ -5700,6 +5714,7 @@ function buildOptimisticExpenseReport( const policyName = getPolicyName({report}); const formattedTotal = convertToDisplayString(storedTotal, currency); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const {stateNum, statusNum} = getExpenseReportStateAndStatus(policy); @@ -6219,8 +6234,10 @@ function buildOptimisticChangePolicyReportAction(fromPolicyID: string | undefine }; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const fromPolicy = getPolicy(fromPolicyID); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const toPolicy = getPolicy(toPolicyID); const changePolicyReportActionMessage = [ @@ -7200,6 +7217,7 @@ function buildOptimisticResolvedDuplicatesReportAction(): OptimisticDismissedVio function buildOptimisticAnnounceChat(policyID: string, accountIDs: number[]): OptimisticAnnounceChat { const announceReport = getRoom(CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE, policyID); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const announceRoomOnyxData: AnnounceRoomOnyxData = { onyxOptimisticData: [], @@ -8376,6 +8394,7 @@ function getMoneyRequestOptions(report: OnyxEntry, policy: OnyxEntry 0; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policyOwnerAccountID = getPolicy(report?.policyID)?.ownerAccountID; const isPolicyOwnedByExpensifyAccounts = policyOwnerAccountID ? CONST.EXPENSIFY_ACCOUNT_IDS.includes(policyOwnerAccountID) : false; if (doParticipantsIncludeExpensifyAccounts && !isPolicyOwnedByExpensifyAccounts) { @@ -8457,6 +8476,7 @@ function canLeaveInvoiceRoom(report: OnyxEntry): boolean { return false; } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const isSenderPolicyAdmin = getPolicy(report.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isSenderPolicyAdmin) { @@ -8468,6 +8488,7 @@ function canLeaveInvoiceRoom(report: OnyxEntry): boolean { } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const isReceiverPolicyAdmin = getPolicy(report.invoiceReceiver.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isReceiverPolicyAdmin) { @@ -8509,6 +8530,7 @@ function canLeaveRoom(report: OnyxEntry, isPolicyEmployee: boolean): boo } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const isSenderPolicyAdmin = getPolicy(report?.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isSenderPolicyAdmin) { @@ -8517,6 +8539,7 @@ function canLeaveRoom(report: OnyxEntry, isPolicyEmployee: boolean): boo const isReceiverPolicyAdmin = // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS ? getPolicy(report?.invoiceReceiver?.policyID)?.role === CONST.POLICY.ROLE.ADMIN : false; if (isReceiverPolicyAdmin) { @@ -9438,6 +9461,7 @@ function isReportOwner(report: OnyxInputOrEntry): boolean { function isAllowedToApproveExpenseReport(report: OnyxEntry, approverAccountID?: number, reportPolicy?: OnyxEntry | SearchPolicy): boolean { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = reportPolicy ?? getPolicy(report?.policyID); const isOwner = (approverAccountID ?? currentUserAccountID) === report?.ownerAccountID; return !(policy?.preventSelfApproval && isOwner); @@ -9445,6 +9469,7 @@ function isAllowedToApproveExpenseReport(report: OnyxEntry, approverAcco function isAllowedToSubmitDraftExpenseReport(report: OnyxEntry): boolean { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(report?.policyID); const submitToAccountID = getSubmitToAccountID(policy, report); @@ -9681,6 +9706,7 @@ function createDraftTransactionAndNavigateToParticipantSelector( if (actionName === CONST.IOU.ACTION.CATEGORIZE) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const activePolicy = getPolicy(activePolicyID); if (activePolicy && shouldRestrictUserBillableActions(activePolicy.id)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(activePolicy.id)); @@ -9810,6 +9836,7 @@ function getOutstandingChildRequest(iouReport: OnyxInputOrEntry): Outsta } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(iouReport.policyID); const shouldBeManuallySubmitted = isPaidGroupPolicyPolicyUtils(policy) && !policy?.harvesting?.enabled; if (shouldBeManuallySubmitted) { @@ -9868,6 +9895,7 @@ function prepareOnboardingOnyxData( const integrationName = userReportedIntegration ? CONST.ONBOARDING_ACCOUNTING_MAPPING[userReportedIntegration as keyof typeof CONST.ONBOARDING_ACCOUNTING_MAPPING] : ''; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const assignedGuideEmail = getPolicy(targetChatPolicyID)?.assignedGuide?.email ?? 'Setup Specialist'; const assignedGuidePersonalDetail = Object.values(allPersonalDetails ?? {}).find((personalDetail) => personalDetail?.login === assignedGuideEmail); let assignedGuideAccountID: number; @@ -10285,6 +10313,7 @@ function prepareOnboardingOnyxData( key: `${ONYXKEYS.COLLECTION.POLICY}${onboardingPolicyID}`, value: { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 areConnectionsEnabled: getPolicy(onboardingPolicyID)?.areConnectionsEnabled, pendingFields: { areConnectionsEnabled: null, @@ -10666,6 +10695,7 @@ function hasMissingInvoiceBankAccount(iouReportID: string | undefined): boolean } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 return invoiceReport?.ownerAccountID === currentUserAccountID && !getPolicy(invoiceReport?.policyID)?.invoice?.bankAccount?.transferBankAccountID && isSettled(iouReportID); } diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 326380065a64..3da56c6e8ba5 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -648,6 +648,7 @@ function getTaskSections(data: OnyxTypes.SearchResults['data']): TaskListItemTyp if (parentReport && personalDetails) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(parentReport.policyID); const parentReportName = getReportName(parentReport, policy, undefined, undefined); const icons = getIcons(parentReport, personalDetails, null, '', -1, policy); diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 2eafa42ddcaf..d5535160a0fd 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -816,6 +816,7 @@ function getRoomWelcomeMessage(report: OnyxEntry, isReportArchived = fal report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL ? getDisplayNameForParticipant({accountID: report?.invoiceReceiver?.accountID}) : // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 getPolicy(report?.invoiceReceiver?.policyID)?.name; const receiver = getPolicyName({report}); welcomeMessage.messageText = `${welcomeMessage.phrase1}${payer} ${translateLocal('common.and')} ${receiver}${welcomeMessage.phrase2}`; diff --git a/src/libs/TransactionUtils/index.ts b/src/libs/TransactionUtils/index.ts index 5907a6883dd0..1e3e772f34a0 100644 --- a/src/libs/TransactionUtils/index.ts +++ b/src/libs/TransactionUtils/index.ts @@ -660,6 +660,7 @@ function getMerchant(transaction: OnyxInputOrEntry, policyParam: On if (transaction && isDistanceRequest(transaction)) { const report = getReportOrDraftReport(transaction.reportID); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = policyParam ?? getPolicy(report?.policyID); const mileageRate = DistanceRequestUtils.getRate({transaction, policy}); const {unit, rate} = mileageRate; @@ -1411,6 +1412,7 @@ function compareDuplicateTransactionFields( const isFirstTransactionCommentEmptyObject = typeof firstTransaction?.comment === 'object' && firstTransaction?.comment?.comment === ''; const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(report?.policyID); const areAllFieldsEqualForKey = areAllFieldsEqual(transactions, (item) => keys.map((key) => item?.[key]).join('|')); diff --git a/src/libs/actions/CompanyCards.ts b/src/libs/actions/CompanyCards.ts index e76ed2deea9c..8d1117c570d0 100644 --- a/src/libs/actions/CompanyCards.ts +++ b/src/libs/actions/CompanyCards.ts @@ -306,6 +306,7 @@ function assignWorkspaceCompanyCard(policyID: string, data?: Partial, policyId?: string) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyId); if (!policy?.achAccount?.bankAccountID) { return false; @@ -8754,6 +8757,7 @@ function getPayMoneyRequestParams( ): PayMoneyRequestData { const isInvoiceReport = isInvoiceReportReportUtils(iouReport); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const activePolicy = getPolicy(activePolicyID); let payerPolicyID = activePolicyID; let chatReport = initialChatReport; @@ -9148,6 +9152,7 @@ function canIOUBePaid( return chatReport?.invoiceReceiver?.accountID === userAccountID; } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 return (invoiceReceiverPolicy ?? getPolicy(chatReport?.invoiceReceiver?.policyID))?.role === CONST.POLICY.ROLE.ADMIN; } @@ -9221,6 +9226,7 @@ function getIOUReportActionToApproveOrPay(chatReport: OnyxEntry, isUnapproved = false) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(report?.policyID); const approvalChain = getApprovalChain(policy, report); const submitToAccountID = getSubmitToAccountID(policy, report); @@ -9284,6 +9291,7 @@ function approveMoneyRequest(expenseReport: OnyxEntry, full?: const optimisticApprovedReportAction = buildOptimisticApprovedReportAction(total, expenseReport.currency ?? '', expenseReport.reportID); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const approvalChain = getApprovalChain(getPolicy(expenseReport.policyID), expenseReport); const predictedNextStatus = isLastApprover(approvalChain) ? CONST.REPORT.STATUS_NUM.APPROVED : CONST.REPORT.STATUS_NUM.SUBMITTED; @@ -9838,6 +9846,7 @@ function submitReport(expenseReport?: OnyxTypes.Report) { const currentNextStep = allNextSteps[`${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`] ?? null; const parentReport = getReportOrDraftReport(expenseReport.parentReportID); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(expenseReport.policyID); const isCurrentUserManager = currentUserPersonalDetails?.accountID === expenseReport.managerID; const isSubmitAndClosePolicy = isSubmitAndClose(policy); @@ -9974,6 +9983,7 @@ function cancelPayment(expenseReport: OnyxEntry, chatReport: O expenseReport.currency ?? '', ); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(chatReport.policyID); const approvalMode = policy?.approvalMode ?? CONST.POLICY.APPROVAL_MODE.BASIC; const stateNum: ValueOf = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.APPROVED; @@ -11849,6 +11859,7 @@ function saveSplitTransactions(draftTransaction: OnyxEntry { diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index b0a2bace5154..27c71e949454 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -350,6 +350,7 @@ function deleteWorkspace(policyID: string, policyName: string) { ]; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); // Restore the old report stateNum and statusNum const failureData: OnyxUpdate[] = [ @@ -477,6 +478,7 @@ function deleteWorkspace(policyID: string, policyName: string) { function setWorkspaceAutoReportingFrequency(policyID: string, frequency: ValueOf) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const wasPolicyOnManualReporting = PolicyUtils.getCorrectedAutoReportingFrequency(policy) === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL; @@ -539,6 +541,7 @@ function setWorkspaceAutoReportingFrequency(policyID: string, frequency: ValueOf function setWorkspaceAutoReportingMonthlyOffset(policyID: string, autoReportingOffset: number | ValueOf) { const value = JSON.stringify({autoReportingOffset}); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ @@ -580,6 +583,7 @@ function setWorkspaceAutoReportingMonthlyOffset(policyID: string, autoReportingO function setWorkspaceApprovalMode(policyID: string, approver: string, approvalMode: ValueOf) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const value = { @@ -634,6 +638,7 @@ function setWorkspaceApprovalMode(policyID: string, approver: string, approvalMo function setWorkspacePayer(policyID: string, reimburserEmail: string) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ @@ -750,6 +755,7 @@ function clearQuickbooksOnlineAutoSyncErrorField(policyID: string | undefined) { function setWorkspaceReimbursement(policyID: string, reimbursementChoice: ValueOf, reimburserEmail: string) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ @@ -1268,6 +1274,7 @@ function updateWorkspaceAvatar(policyID: string, file: File) { */ function deleteWorkspaceAvatar(policyID: string) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ { @@ -2462,6 +2469,7 @@ function requestExpensifyCardLimitIncrease(settlementBankAccountID?: number) { function updateMemberCustomField(policyID: string, login: string, customFieldType: CustomFieldType, value: string) { const customFieldKey = CONST.CUSTOM_FIELD_KEYS[customFieldType]; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const previousValue = policy?.employeeList?.[login]?.[customFieldKey]; @@ -3242,6 +3250,7 @@ function enablePolicyTaxes(policyID: string, enabled: boolean) { ], }; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const shouldAddDefaultTaxRatesData = (!policy?.taxRates || isEmptyObject(policy.taxRates)) && enabled; @@ -3311,6 +3320,7 @@ function enablePolicyTaxes(policyID: string, enabled: boolean) { function enablePolicyWorkflows(policyID: string, enabled: boolean) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const onyxData: OnyxData = { optimisticData: [ @@ -3421,6 +3431,7 @@ const DISABLED_MAX_EXPENSE_VALUES: Pick, reportID: strin function createNewReport(creatorPersonalDetails: PersonalDetails, policyID?: string, shouldNotifyNewAction = false) { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const optimisticReportID = generateReportID(); const reportActionID = rand64(); @@ -4931,6 +4932,7 @@ function deleteAppReport(reportID: string | undefined) { function moveIOUReportToPolicy(reportID: string, policyID: string) { const iouReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); // This flow only works for IOU reports @@ -5100,6 +5102,7 @@ function moveIOUReportToPolicy(reportID: string, policyID: string) { function moveIOUReportToPolicyAndInviteSubmitter(reportID: string, policyID: string) { const iouReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); if (!policy || !iouReport) { diff --git a/src/libs/actions/TeachersUnite.ts b/src/libs/actions/TeachersUnite.ts index 5c534d00f29a..b73ab441ff9c 100644 --- a/src/libs/actions/TeachersUnite.ts +++ b/src/libs/actions/TeachersUnite.ts @@ -117,6 +117,7 @@ function addSchoolPrincipal(firstName: string, partnerUserID: string, lastName: role: CONST.POLICY.ROLE.USER, owner: sessionEmail, // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 outputCurrency: getPolicy(policyID)?.outputCurrency ?? allPersonalDetails?.[sessionAccountID]?.localCurrencyCode ?? CONST.CURRENCY.USD, employeeList: { [sessionEmail]: { diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts index 3ee5b6fbff5f..ef81e922a78a 100644 --- a/src/libs/actions/connections/index.ts +++ b/src/libs/actions/connections/index.ts @@ -35,6 +35,7 @@ function removePolicyConnection(policyID: string, connectionName: PolicyConnecti const successData: OnyxUpdate[] = []; const failureData: OnyxUpdate[] = []; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = PolicyUtils.getPolicy(policyID); const supportedConnections: PolicyConnectionName[] = [CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.POLICY.CONNECTIONS.NAME.XERO]; diff --git a/src/pages/ReportChangeWorkspacePage.tsx b/src/pages/ReportChangeWorkspacePage.tsx index 49458ca662d2..c70e5c79c45b 100644 --- a/src/pages/ReportChangeWorkspacePage.tsx +++ b/src/pages/ReportChangeWorkspacePage.tsx @@ -46,6 +46,7 @@ function ReportChangeWorkspacePage({report}: ReportChangeWorkspacePageProps) { } Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(reportID)); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 if (isIOUReport(reportID) && isPolicyAdmin(getPolicy(policyID)) && report.ownerAccountID && !isPolicyMember(getLoginByAccountID(report.ownerAccountID), policyID)) { moveIOUReportToPolicyAndInviteSubmitter(reportID, policyID); } else if (isIOUReport(reportID) && isPolicyMember(session?.email, policyID)) { diff --git a/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx b/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx index 7142432c4f72..c4395d6691e1 100644 --- a/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx +++ b/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx @@ -26,6 +26,7 @@ function WorkspaceAdminRestrictedAction({policyID}: WorkspaceAdminRestrictedActi const openAdminsReport = useCallback(() => { // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const reportID = `${PolicyUtils.getPolicy(policyID)?.chatReportIDAdmins}` ?? '-1'; Navigation.closeRHPFlow(); Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); diff --git a/src/pages/TransactionDuplicate/ReviewTaxCode.tsx b/src/pages/TransactionDuplicate/ReviewTaxCode.tsx index 907242805911..7e491fa79e05 100644 --- a/src/pages/TransactionDuplicate/ReviewTaxCode.tsx +++ b/src/pages/TransactionDuplicate/ReviewTaxCode.tsx @@ -23,6 +23,7 @@ function ReviewTaxRate() { const [reviewDuplicates] = useOnyx(ONYXKEYS.REVIEW_DUPLICATES); const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reviewDuplicates?.reportID ?? route.params.threadReportID}`); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = PolicyUtils.getPolicy(report?.policyID ?? ''); const transactionID = TransactionUtils.getTransactionID(route.params.threadReportID ?? ''); const compareResult = TransactionUtils.compareDuplicateTransactionFields(transactionID, reviewDuplicates?.reportID ?? '-1'); diff --git a/src/pages/home/report/SystemChatReportFooterMessage.tsx b/src/pages/home/report/SystemChatReportFooterMessage.tsx index 0918f8ed0b4e..10e2c1c3e4f1 100644 --- a/src/pages/home/report/SystemChatReportFooterMessage.tsx +++ b/src/pages/home/report/SystemChatReportFooterMessage.tsx @@ -24,6 +24,7 @@ function SystemChatReportFooterMessage() { const adminChatReportID = useMemo(() => { const adminPolicy = activePolicyID ? // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 PolicyUtils.getPolicy(activePolicyID) : Object.values(policies ?? {}).find( (policy) => PolicyUtils.shouldShowPolicy(policy, false, currentUserLogin) && policy?.role === CONST.POLICY.ROLE.ADMIN && policy?.chatReportIDAdmins, diff --git a/src/pages/iou/SplitExpenseEditPage.tsx b/src/pages/iou/SplitExpenseEditPage.tsx index d5f24724aed6..67a3a127eff6 100644 --- a/src/pages/iou/SplitExpenseEditPage.tsx +++ b/src/pages/iou/SplitExpenseEditPage.tsx @@ -39,6 +39,7 @@ function SplitExpenseEditPage({route}: SplitExpensePageProps) { const [splitExpenseDraftTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, {canBeMissing: false}); const splitExpenseDraftTransactionDetails = useMemo>(() => getTransactionDetails(splitExpenseDraftTransaction) ?? {}, [splitExpenseDraftTransaction]); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(report?.policyID); const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report?.policyID}`, {canBeMissing: false}); const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${report?.policyID}`, {canBeMissing: false}); diff --git a/src/pages/iou/request/step/IOURequestStepDistance.tsx b/src/pages/iou/request/step/IOURequestStepDistance.tsx index fc5fccc5ecb8..d7fbf4e44dfb 100644 --- a/src/pages/iou/request/step/IOURequestStepDistance.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistance.tsx @@ -149,6 +149,7 @@ function IOURequestStepDistance({ const IOUpolicyID = getIOURequestPolicyID(transaction, policyReport); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const IOUpolicy = getPolicy(report?.policyID ?? IOUpolicyID); const policyCurrency = policy?.outputCurrency ?? getPersonalPolicy()?.outputCurrency ?? CONST.CURRENCY.USD; diff --git a/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx b/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx index 0afaa0618cc7..fa9bf5743ad6 100644 --- a/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx +++ b/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx @@ -65,6 +65,7 @@ function IOURequestStepPerDiemWorkspace({ return; } // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const selectedPolicy = getPolicy(item.value, allPolicies); const perDiemUnit = getPerDiemCustomUnit(selectedPolicy); setMoneyRequestParticipants(transactionID, [ diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index c9a5cebb7e8d..2ac5ea402eb8 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -147,6 +147,7 @@ function WorkspacesListPage() { canBeMissing: true, }); // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policyToDelete = getPolicy(policyIDToDelete); const hasCardFeedOrExpensifyCard = !isEmptyObject(cardFeeds) || diff --git a/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx b/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx index 9b8367382e3e..51ea70ded409 100644 --- a/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx +++ b/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx @@ -52,6 +52,7 @@ type WorkspaceMemberNewCardPageProps = WithPolicyAndFullscreenLoadingProps & Pla function WorkspaceMemberNewCardPage({route, personalDetails}: WorkspaceMemberNewCardPageProps) { const {policyID} = route.params; // eslint-disable-next-line deprecation/deprecation + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 const policy = getPolicy(policyID); const workspaceAccountID = policy?.workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID; From d7c76900c63694c2f485b2b6b09004a208cca44b Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 6 Jun 2025 10:06:13 -0600 Subject: [PATCH 07/10] fix lint --- src/libs/SidebarUtils.ts | 2 +- src/pages/home/report/SystemChatReportFooterMessage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index d5535160a0fd..f8099ee72948 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -816,7 +816,7 @@ function getRoomWelcomeMessage(report: OnyxEntry, isReportArchived = fal report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL ? getDisplayNameForParticipant({accountID: report?.invoiceReceiver?.accountID}) : // eslint-disable-next-line deprecation/deprecation - // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 getPolicy(report?.invoiceReceiver?.policyID)?.name; const receiver = getPolicyName({report}); welcomeMessage.messageText = `${welcomeMessage.phrase1}${payer} ${translateLocal('common.and')} ${receiver}${welcomeMessage.phrase2}`; diff --git a/src/pages/home/report/SystemChatReportFooterMessage.tsx b/src/pages/home/report/SystemChatReportFooterMessage.tsx index 10e2c1c3e4f1..6ece8b50c6b7 100644 --- a/src/pages/home/report/SystemChatReportFooterMessage.tsx +++ b/src/pages/home/report/SystemChatReportFooterMessage.tsx @@ -24,7 +24,7 @@ function SystemChatReportFooterMessage() { const adminChatReportID = useMemo(() => { const adminPolicy = activePolicyID ? // eslint-disable-next-line deprecation/deprecation - // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 PolicyUtils.getPolicy(activePolicyID) : Object.values(policies ?? {}).find( (policy) => PolicyUtils.shouldShowPolicy(policy, false, currentUserLogin) && policy?.role === CONST.POLICY.ROLE.ADMIN && policy?.chatReportIDAdmins, From acd5ab8ebc7c5f597d5a8aaf0cd27eb280edade0 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 6 Jun 2025 10:16:38 -0600 Subject: [PATCH 08/10] reorder comments --- src/components/ReportWelcomeText.tsx | 2 +- src/libs/CardFeedUtils.ts | 2 +- src/libs/CardMessageUtils.ts | 2 +- src/libs/DistanceRequestUtils.ts | 2 +- src/libs/PerDiemRequestUtils.ts | 2 +- src/libs/PolicyUtils.ts | 18 ++--- src/libs/ReportActionsUtils.ts | 4 +- src/libs/ReportUtils.ts | 62 ++++++++-------- src/libs/SearchUIUtils.ts | 2 +- src/libs/SidebarUtils.ts | 4 +- src/libs/TransactionUtils/index.ts | 4 +- src/libs/actions/CompanyCards.ts | 2 +- src/libs/actions/IOU.ts | 22 +++--- src/libs/actions/Policy/Category.ts | 4 +- src/libs/actions/Policy/Member.ts | 8 +- src/libs/actions/Policy/Policy.ts | 74 +++++++++---------- src/libs/actions/Policy/Tag.ts | 4 +- src/libs/actions/Report.ts | 6 +- src/libs/actions/TeachersUnite.ts | 2 +- src/libs/actions/connections/index.ts | 2 +- src/pages/ReportChangeWorkspacePage.tsx | 2 +- .../WorkspaceAdminRestrictedAction.tsx | 2 +- .../TransactionDuplicate/ReviewTaxCode.tsx | 2 +- .../report/SystemChatReportFooterMessage.tsx | 4 +- .../request/step/IOURequestStepDistance.tsx | 2 +- .../step/IOURequestStepPerDiemWorkspace.tsx | 2 +- src/pages/workspace/WorkspacesListPage.tsx | 2 +- .../members/WorkspaceMemberNewCardPage.tsx | 2 +- 28 files changed, 123 insertions(+), 123 deletions(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 5f555de81a86..04d661131488 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -155,8 +155,8 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { {report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL ? ( {getDisplayNameForParticipant({accountID: report?.invoiceReceiver?.accountID})} ) : ( - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation {getPolicy(report?.invoiceReceiver?.policyID)?.name} )} diff --git a/src/libs/CardFeedUtils.ts b/src/libs/CardFeedUtils.ts index b84cee44fb87..66c0909cead4 100644 --- a/src/libs/CardFeedUtils.ts +++ b/src/libs/CardFeedUtils.ts @@ -165,8 +165,8 @@ function getWorkspaceCardFeedData(cardFeed: WorkspaceCardsList | undefined, repe const {domainName, bank} = representativeCard; const isBankRepeating = repeatingBanks.includes(bank); const policyID = domainName.match(CONST.REGEX.EXPENSIFY_POLICY_DOMAIN_NAME)?.[1] ?? ''; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const correspondingPolicy = getPolicy(policyID?.toUpperCase()); const cardFeedLabel = isBankRepeating ? correspondingPolicy?.name : undefined; const cardFeedBankName = bank === CONST.EXPENSIFY_CARD.BANK ? translate('search.filters.card.expensify') : getBankName(bank as CompanyCardFeed); diff --git a/src/libs/CardMessageUtils.ts b/src/libs/CardMessageUtils.ts index 60e6ced396c1..5ac2ae9f8f3c 100644 --- a/src/libs/CardMessageUtils.ts +++ b/src/libs/CardMessageUtils.ts @@ -42,8 +42,8 @@ function getExpensifyCardFromReportAction({reportAction, policyID}: {reportActio const cardID = cardIssuedActionOriginalMessage?.cardID ?? CONST.DEFAULT_NUMBER_ID; const workspaceAccountID = getWorkspaceAccountID(policyID); const allExpensifyCards = allWorkspaceCards?.[`cards_${workspaceAccountID}_${CONST.EXPENSIFY_CARD.BANK}`] ?? {}; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation return isPolicyAdmin(getPolicy(policyID)) ? allExpensifyCards?.[cardID] : allUserCards[cardID]; } diff --git a/src/libs/DistanceRequestUtils.ts b/src/libs/DistanceRequestUtils.ts index 108f2aa9c64a..f1de938c492b 100644 --- a/src/libs/DistanceRequestUtils.ts +++ b/src/libs/DistanceRequestUtils.ts @@ -302,8 +302,8 @@ function getCustomUnitRateID(reportID?: string) { } const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`]; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID ?? parentReport?.policyID); if (isEmptyObject(policy)) { diff --git a/src/libs/PerDiemRequestUtils.ts b/src/libs/PerDiemRequestUtils.ts index 870f5599f20b..8f47471b2b7d 100644 --- a/src/libs/PerDiemRequestUtils.ts +++ b/src/libs/PerDiemRequestUtils.ts @@ -27,8 +27,8 @@ Onyx.connect({ function getCustomUnitID(reportID: string) { const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; const parentReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`]; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID ?? parentReport?.policyID); let customUnitID: string = CONST.CUSTOM_UNITS.FAKE_P2P_ID; let category: string | undefined; diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 2668a2683c3e..53f019e5e41b 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -739,8 +739,8 @@ function hasPolicyWithXeroConnection(currentUserLogin: string | undefined) { /** Whether the user can send invoice from the workspace */ function canSendInvoiceFromWorkspace(policyID: string | undefined): boolean { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); return policy?.areInvoicesEnabled ?? false; } @@ -1199,8 +1199,8 @@ function getCurrentTaxID(policy: OnyxEntry, taxID: string): string | und } function getWorkspaceAccountID(policyID?: string) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); if (!policy) { @@ -1210,8 +1210,8 @@ function getWorkspaceAccountID(policyID?: string) { } function hasVBBA(policyID: string | undefined) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); return !!policy?.achAccount?.bankAccountID; } @@ -1220,8 +1220,8 @@ function getTagApproverRule(policyOrID: string | SearchPolicy | OnyxEntry { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation return getPolicy(activePolicyId); } @@ -1288,8 +1288,8 @@ function getGroupPaidPoliciesWithExpenseChatEnabled(policies: OnyxCollection 1; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); return !!policy && isPolicyAdmin(policy); @@ -1388,8 +1388,8 @@ const getDescriptionForPolicyDomainCard = (domainName: string): string => { // A domain name containing a policyID indicates that this is a workspace feed const policyID = domainName.match(CONST.REGEX.EXPENSIFY_POLICY_DOMAIN_NAME)?.[1]; if (policyID) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID.toUpperCase()); return policy?.name ?? domainName; } @@ -1434,8 +1434,8 @@ export { getNumericValue, isMultiLevelTags, getPersonalPolicy, - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation getPolicy, getPolicyBrickRoadIndicatorStatus, getPolicyEmployeeListByIdWithoutCurrentUser, diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 0c0378b9f634..667494a4fbea 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2348,8 +2348,8 @@ function shouldShowAddMissingDetails(actionName?: ReportActionName, card?: Card) } function getJoinRequestMessage(reportAction: ReportAction) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(getOriginalMessage(reportAction)?.policyID); const userDetail = getPersonalDetailByEmail(getOriginalMessage(reportAction)?.email ?? ''); const userName = userDetail?.firstName ? `${userDetail.displayName} (${userDetail.login})` : (userDetail?.login ?? getOriginalMessage(reportAction)?.email); @@ -2379,8 +2379,8 @@ function getCardIssuedMessage({ const assigneeAccountID = cardIssuedActionOriginalMessage?.assigneeAccountID ?? CONST.DEFAULT_NUMBER_ID; const cardID = cardIssuedActionOriginalMessage?.cardID ?? CONST.DEFAULT_NUMBER_ID; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const isPolicyAdmin = isPolicyAdminPolicyUtils(getPolicy(policyID)); const assignee = shouldRenderHTML ? `` : Parser.htmlToText(``); const navigateRoute = isPolicyAdmin ? ROUTES.EXPENSIFY_CARD_DETAILS.getRoute(policyID, String(cardID)) : ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(String(cardID)); diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 29a1a37df076..dd38feb7cced 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1541,8 +1541,8 @@ function isCurrentUserInvoiceReceiver(report: OnyxEntry): boolean { } if (report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report.invoiceReceiver.policyID); return isPolicyAdminPolicyUtils(policy); } @@ -1782,8 +1782,8 @@ function isAwaitingFirstLevelApproval(report: OnyxEntry): boolean { return false; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const submitsToAccountID = getSubmitToAccountID(getPolicy(report.policyID), report); return isProcessingReport(report) && submitsToAccountID === report.managerID; @@ -1996,8 +1996,8 @@ function isJoinRequestInAdminRoom(report: OnyxEntry): boolean { // Account manager/guide should not have the workspace join request pinned to their LHN, // since they are not a part of the company, and should not action it on their behalf. if (report.policyID) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report.policyID); if (!isExpensifyTeam(policy?.owner) && isExpensifyTeam(currentUserPersonalDetails?.login)) { return false; @@ -2011,8 +2011,8 @@ function isJoinRequestInAdminRoom(report: OnyxEntry): boolean { */ function isAuditor(report: OnyxEntry): boolean { if (report?.policyID) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report.policyID); return isPolicyAuditor(policy); } @@ -2345,8 +2345,8 @@ function canAddOrDeleteTransactions(moneyRequestReport: OnyxEntry, isRep if (!isMoneyRequestReport(moneyRequestReport) || isReportArchived) { return false; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(moneyRequestReport?.policyID); if (isInstantSubmitEnabled(policy) && isSubmitAndClose(policy) && !arePaymentsEnabled(policy)) { @@ -2374,8 +2374,8 @@ function canAddTransaction(moneyRequestReport: OnyxEntry, isReportArchiv if (!isMoneyRequestReport(moneyRequestReport)) { return false; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(moneyRequestReport?.policyID); if (isInstantSubmitEnabled(policy) && isSubmitAndClose(policy) && hasOnlyNonReimbursableTransactions(moneyRequestReport?.reportID)) { return false; @@ -2980,8 +2980,8 @@ function getIcons( return [domainIcon]; } - // This will get removed as part of https://github.com/Expensify/App/issues/59961 // eslint-disable-next-line deprecation/deprecation + // This will get removed as part of https://github.com/Expensify/App/issues/59961 if (isAdminRoom(report) || isAnnounceRoom(report) || isChatRoom(report) || isArchivedNonExpenseReport(report, getReportNameValuePairs(report?.reportID))) { const icons = [getWorkspaceIcon(report, policy)]; @@ -2990,8 +2990,8 @@ function getIcons( icons.push(...getIconsForParticipants([report?.invoiceReceiver.accountID], personalDetails)); } else { const receiverPolicyID = report?.invoiceReceiver?.policyID; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const receiverPolicy = invoiceReceiverPolicy ?? getPolicy(receiverPolicyID); if (!isEmptyObject(receiverPolicy)) { icons.push({ @@ -3073,8 +3073,8 @@ function getIcons( } const receiverPolicyID = invoiceRoomReport?.invoiceReceiver?.policyID; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const receiverPolicy = invoiceReceiverPolicy ?? getPolicy(receiverPolicyID); if (!isEmptyObject(receiverPolicy)) { @@ -3407,8 +3407,8 @@ function getReasonAndReportActionThatRequiresAttention( const hasOnlyPendingTransactions = transactions.length > 0 && transactions.every((t) => isExpensifyCardTransaction(t) && isPending(t)); // Has a child report that is awaiting action (e.g. approve, pay, add bank account) from current user - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(optionOrReport.policyID); if ( (optionOrReport.hasOutstandingChildRequest === true || iouReportActionToApproveOrPay?.reportActionID) && @@ -3834,8 +3834,8 @@ function canEditMoneyRequest(reportAction: OnyxInputOrEntry return false; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(moneyRequestReport?.policyID); const isAdmin = isExpenseReport(moneyRequestReport) && policy?.role === CONST.POLICY.ROLE.ADMIN; const isManager = isExpenseReport(moneyRequestReport) && currentUserAccountID === moneyRequestReport?.managerID; @@ -4666,8 +4666,8 @@ function getInvoicesChatName({ const isIndividual = invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL; const invoiceReceiverAccountID = isIndividual ? invoiceReceiver.accountID : CONST.DEFAULT_NUMBER_ID; const invoiceReceiverPolicyID = isIndividual ? undefined : invoiceReceiver?.policyID; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const invoiceReceiverPolicy = receiverPolicy ?? getPolicy(invoiceReceiverPolicyID); const isCurrentUserReceiver = (isIndividual && invoiceReceiverAccountID === currentUserAccountID) || (!isIndividual && isPolicyAdminPolicyUtils(invoiceReceiverPolicy)); @@ -5284,8 +5284,8 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails, mediaAt } if (parsingDetails?.policyID) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policyType = getPolicy(parsingDetails?.policyID)?.type; if (policyType) { isGroupPolicyReport = isGroupPolicy(policyType); @@ -5554,8 +5554,8 @@ function buildOptimisticIOUReport( const personalDetails = getPersonalDetailsForAccountID(payerAccountID); const payerEmail = 'login' in personalDetails ? personalDetails.login : ''; const policyID = chatReportID ? getReport(chatReportID, allReports)?.policyID : undefined; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const participants: Participants = { @@ -5713,8 +5713,8 @@ function buildOptimisticExpenseReport( const report = chatReportID ? getReport(chatReportID, allReports) : undefined; const policyName = getPolicyName({report}); const formattedTotal = convertToDisplayString(storedTotal, currency); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const {stateNum, statusNum} = getExpenseReportStateAndStatus(policy); @@ -6233,11 +6233,11 @@ function buildOptimisticChangePolicyReportAction(fromPolicyID: string | undefine automaticAction, }; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 - const fromPolicy = getPolicy(fromPolicyID); // eslint-disable-next-line deprecation/deprecation + const fromPolicy = getPolicy(fromPolicyID); // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const toPolicy = getPolicy(toPolicyID); const changePolicyReportActionMessage = [ @@ -7216,8 +7216,8 @@ function buildOptimisticResolvedDuplicatesReportAction(): OptimisticDismissedVio function buildOptimisticAnnounceChat(policyID: string, accountIDs: number[]): OptimisticAnnounceChat { const announceReport = getRoom(CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE, policyID); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const announceRoomOnyxData: AnnounceRoomOnyxData = { onyxOptimisticData: [], @@ -8393,8 +8393,8 @@ function getMoneyRequestOptions(report: OnyxEntry, policy: OnyxEntry 0; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policyOwnerAccountID = getPolicy(report?.policyID)?.ownerAccountID; const isPolicyOwnedByExpensifyAccounts = policyOwnerAccountID ? CONST.EXPENSIFY_ACCOUNT_IDS.includes(policyOwnerAccountID) : false; if (doParticipantsIncludeExpensifyAccounts && !isPolicyOwnedByExpensifyAccounts) { @@ -8475,8 +8475,8 @@ function canLeaveInvoiceRoom(report: OnyxEntry): boolean { if (report?.statusNum === CONST.REPORT.STATUS_NUM.CLOSED) { return false; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const isSenderPolicyAdmin = getPolicy(report.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isSenderPolicyAdmin) { @@ -8487,8 +8487,8 @@ function canLeaveInvoiceRoom(report: OnyxEntry): boolean { return report?.invoiceReceiver?.accountID !== currentUserAccountID; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const isReceiverPolicyAdmin = getPolicy(report.invoiceReceiver.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isReceiverPolicyAdmin) { @@ -8529,8 +8529,8 @@ function canLeaveRoom(report: OnyxEntry, isPolicyEmployee: boolean): boo return false; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const isSenderPolicyAdmin = getPolicy(report?.policyID)?.role === CONST.POLICY.ROLE.ADMIN; if (isSenderPolicyAdmin) { @@ -8538,8 +8538,8 @@ function canLeaveRoom(report: OnyxEntry, isPolicyEmployee: boolean): boo } const isReceiverPolicyAdmin = + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 // eslint-disable-next-line deprecation/deprecation - // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS ? getPolicy(report?.invoiceReceiver?.policyID)?.role === CONST.POLICY.ROLE.ADMIN : false; if (isReceiverPolicyAdmin) { @@ -9460,16 +9460,16 @@ function isReportOwner(report: OnyxInputOrEntry): boolean { } function isAllowedToApproveExpenseReport(report: OnyxEntry, approverAccountID?: number, reportPolicy?: OnyxEntry | SearchPolicy): boolean { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = reportPolicy ?? getPolicy(report?.policyID); const isOwner = (approverAccountID ?? currentUserAccountID) === report?.ownerAccountID; return !(policy?.preventSelfApproval && isOwner); } function isAllowedToSubmitDraftExpenseReport(report: OnyxEntry): boolean { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID); const submitToAccountID = getSubmitToAccountID(policy, report); @@ -9705,8 +9705,8 @@ function createDraftTransactionAndNavigateToParticipantSelector( const filteredPolicies = Object.values(allPolicies ?? {}).filter((policy) => shouldShowPolicy(policy, false, currentUserEmail)); if (actionName === CONST.IOU.ACTION.CATEGORIZE) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const activePolicy = getPolicy(activePolicyID); if (activePolicy && shouldRestrictUserBillableActions(activePolicy.id)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(activePolicy.id)); @@ -9835,8 +9835,8 @@ function getOutstandingChildRequest(iouReport: OnyxInputOrEntry): Outsta }; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(iouReport.policyID); const shouldBeManuallySubmitted = isPaidGroupPolicyPolicyUtils(policy) && !policy?.harvesting?.enabled; if (shouldBeManuallySubmitted) { @@ -9894,8 +9894,8 @@ function prepareOnboardingOnyxData( } const integrationName = userReportedIntegration ? CONST.ONBOARDING_ACCOUNTING_MAPPING[userReportedIntegration as keyof typeof CONST.ONBOARDING_ACCOUNTING_MAPPING] : ''; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const assignedGuideEmail = getPolicy(targetChatPolicyID)?.assignedGuide?.email ?? 'Setup Specialist'; const assignedGuidePersonalDetail = Object.values(allPersonalDetails ?? {}).find((personalDetail) => personalDetail?.login === assignedGuideEmail); let assignedGuideAccountID: number; @@ -10312,8 +10312,8 @@ function prepareOnboardingOnyxData( onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.POLICY}${onboardingPolicyID}`, value: { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation areConnectionsEnabled: getPolicy(onboardingPolicyID)?.areConnectionsEnabled, pendingFields: { areConnectionsEnabled: null, @@ -10694,8 +10694,8 @@ function hasMissingInvoiceBankAccount(iouReportID: string | undefined): boolean return false; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation return invoiceReport?.ownerAccountID === currentUserAccountID && !getPolicy(invoiceReport?.policyID)?.invoice?.bankAccount?.transferBankAccountID && isSettled(iouReportID); } diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 3da56c6e8ba5..6b6126368e83 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -647,8 +647,8 @@ function getTaskSections(data: OnyxTypes.SearchResults['data']): TaskListItemTyp }; if (parentReport && personalDetails) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(parentReport.policyID); const parentReportName = getReportName(parentReport, policy, undefined, undefined); const icons = getIcons(parentReport, personalDetails, null, '', -1, policy); diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index f8099ee72948..4363bd7d6e0a 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -815,8 +815,8 @@ function getRoomWelcomeMessage(report: OnyxEntry, isReportArchived = fal const payer = report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL ? getDisplayNameForParticipant({accountID: report?.invoiceReceiver?.accountID}) - : // eslint-disable-next-line deprecation/deprecation - // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + : // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation getPolicy(report?.invoiceReceiver?.policyID)?.name; const receiver = getPolicyName({report}); welcomeMessage.messageText = `${welcomeMessage.phrase1}${payer} ${translateLocal('common.and')} ${receiver}${welcomeMessage.phrase2}`; diff --git a/src/libs/TransactionUtils/index.ts b/src/libs/TransactionUtils/index.ts index 1e3e772f34a0..5db93b69ab6b 100644 --- a/src/libs/TransactionUtils/index.ts +++ b/src/libs/TransactionUtils/index.ts @@ -659,8 +659,8 @@ function isFetchingWaypointsFromServer(transaction: OnyxInputOrEntry, policyParam: OnyxEntry = undefined): string { if (transaction && isDistanceRequest(transaction)) { const report = getReportOrDraftReport(transaction.reportID); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = policyParam ?? getPolicy(report?.policyID); const mileageRate = DistanceRequestUtils.getRate({transaction, policy}); const {unit, rate} = mileageRate; @@ -1411,8 +1411,8 @@ function compareDuplicateTransactionFields( const firstTransaction = transactions.at(0); const isFirstTransactionCommentEmptyObject = typeof firstTransaction?.comment === 'object' && firstTransaction?.comment?.comment === ''; const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID); const areAllFieldsEqualForKey = areAllFieldsEqual(transactions, (item) => keys.map((key) => item?.[key]).join('|')); diff --git a/src/libs/actions/CompanyCards.ts b/src/libs/actions/CompanyCards.ts index 8d1117c570d0..785d921583f2 100644 --- a/src/libs/actions/CompanyCards.ts +++ b/src/libs/actions/CompanyCards.ts @@ -305,8 +305,8 @@ function assignWorkspaceCompanyCard(policyID: string, data?: Partial, policyId?: string) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyId); if (!policy?.achAccount?.bankAccountID) { return false; @@ -8756,8 +8756,8 @@ function getPayMoneyRequestParams( payAsBusiness?: boolean, ): PayMoneyRequestData { const isInvoiceReport = isInvoiceReportReportUtils(iouReport); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const activePolicy = getPolicy(activePolicyID); let payerPolicyID = activePolicyID; let chatReport = initialChatReport; @@ -9151,8 +9151,8 @@ function canIOUBePaid( if (chatReport?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL) { return chatReport?.invoiceReceiver?.accountID === userAccountID; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation return (invoiceReceiverPolicy ?? getPolicy(chatReport?.invoiceReceiver?.policyID))?.role === CONST.POLICY.ROLE.ADMIN; } @@ -9225,8 +9225,8 @@ function getIOUReportActionToApproveOrPay(chatReport: OnyxEntry, isUnapproved = false) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID); const approvalChain = getApprovalChain(policy, report); const submitToAccountID = getSubmitToAccountID(policy, report); @@ -9290,8 +9290,8 @@ function approveMoneyRequest(expenseReport: OnyxEntry, full?: } const optimisticApprovedReportAction = buildOptimisticApprovedReportAction(total, expenseReport.currency ?? '', expenseReport.reportID); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const approvalChain = getApprovalChain(getPolicy(expenseReport.policyID), expenseReport); const predictedNextStatus = isLastApprover(approvalChain) ? CONST.REPORT.STATUS_NUM.APPROVED : CONST.REPORT.STATUS_NUM.SUBMITTED; @@ -9845,8 +9845,8 @@ function submitReport(expenseReport?: OnyxTypes.Report) { const currentNextStep = allNextSteps[`${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`] ?? null; const parentReport = getReportOrDraftReport(expenseReport.parentReportID); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(expenseReport.policyID); const isCurrentUserManager = currentUserPersonalDetails?.accountID === expenseReport.managerID; const isSubmitAndClosePolicy = isSubmitAndClose(policy); @@ -9982,8 +9982,8 @@ function cancelPayment(expenseReport: OnyxEntry, chatReport: O -((expenseReport.total ?? 0) - (expenseReport?.nonReimbursableTotal ?? 0)), expenseReport.currency ?? '', ); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(chatReport.policyID); const approvalMode = policy?.approvalMode ?? CONST.POLICY.APPROVAL_MODE.BASIC; const stateNum: ValueOf = approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.APPROVED; @@ -11858,8 +11858,8 @@ function saveSplitTransactions(draftTransaction: OnyxEntry { diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 27c71e949454..9f8aa84369cb 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -349,8 +349,8 @@ function deleteWorkspace(policyID: string, policyName: string) { : []), ]; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); // Restore the old report stateNum and statusNum const failureData: OnyxUpdate[] = [ @@ -477,8 +477,8 @@ function deleteWorkspace(policyID: string, policyName: string) { } function setWorkspaceAutoReportingFrequency(policyID: string, frequency: ValueOf) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const wasPolicyOnManualReporting = PolicyUtils.getCorrectedAutoReportingFrequency(policy) === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL; @@ -540,8 +540,8 @@ function setWorkspaceAutoReportingFrequency(policyID: string, frequency: ValueOf function setWorkspaceAutoReportingMonthlyOffset(policyID: string, autoReportingOffset: number | ValueOf) { const value = JSON.stringify({autoReportingOffset}); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ @@ -582,8 +582,8 @@ function setWorkspaceAutoReportingMonthlyOffset(policyID: string, autoReportingO } function setWorkspaceApprovalMode(policyID: string, approver: string, approvalMode: ValueOf) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const value = { @@ -637,8 +637,8 @@ function setWorkspaceApprovalMode(policyID: string, approver: string, approvalMo } function setWorkspacePayer(policyID: string, reimburserEmail: string) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ @@ -754,8 +754,8 @@ function clearQuickbooksOnlineAutoSyncErrorField(policyID: string | undefined) { } function setWorkspaceReimbursement(policyID: string, reimbursementChoice: ValueOf, reimburserEmail: string) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ @@ -1273,8 +1273,8 @@ function updateWorkspaceAvatar(policyID: string, file: File) { * Deletes the avatar image for the workspace */ function deleteWorkspaceAvatar(policyID: string) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const optimisticData: OnyxUpdate[] = [ { @@ -2468,8 +2468,8 @@ function requestExpensifyCardLimitIncrease(settlementBankAccountID?: number) { function updateMemberCustomField(policyID: string, login: string, customFieldType: CustomFieldType, value: string) { const customFieldKey = CONST.CUSTOM_FIELD_KEYS[customFieldType]; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const previousValue = policy?.employeeList?.[login]?.[customFieldKey]; @@ -3249,8 +3249,8 @@ function enablePolicyTaxes(policyID: string, enabled: boolean) { }, ], }; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const shouldAddDefaultTaxRatesData = (!policy?.taxRates || isEmptyObject(policy.taxRates)) && enabled; @@ -3319,8 +3319,8 @@ function enablePolicyTaxes(policyID: string, enabled: boolean) { } function enablePolicyWorkflows(policyID: string, enabled: boolean) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const onyxData: OnyxData = { optimisticData: [ @@ -3430,8 +3430,8 @@ const DISABLED_MAX_EXPENSE_VALUES: Pick, reportID: strin } function createNewReport(creatorPersonalDetails: PersonalDetails, policyID?: string, shouldNotifyNewAction = false) { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const optimisticReportID = generateReportID(); const reportActionID = rand64(); @@ -4931,8 +4931,8 @@ function deleteAppReport(reportID: string | undefined) { */ function moveIOUReportToPolicy(reportID: string, policyID: string) { const iouReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); // This flow only works for IOU reports @@ -5101,8 +5101,8 @@ function moveIOUReportToPolicy(reportID: string, policyID: string) { */ function moveIOUReportToPolicyAndInviteSubmitter(reportID: string, policyID: string) { const iouReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); if (!policy || !iouReport) { diff --git a/src/libs/actions/TeachersUnite.ts b/src/libs/actions/TeachersUnite.ts index b73ab441ff9c..7d57ae57a213 100644 --- a/src/libs/actions/TeachersUnite.ts +++ b/src/libs/actions/TeachersUnite.ts @@ -116,8 +116,8 @@ function addSchoolPrincipal(firstName: string, partnerUserID: string, lastName: name: policyName, role: CONST.POLICY.ROLE.USER, owner: sessionEmail, - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation outputCurrency: getPolicy(policyID)?.outputCurrency ?? allPersonalDetails?.[sessionAccountID]?.localCurrencyCode ?? CONST.CURRENCY.USD, employeeList: { [sessionEmail]: { diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts index ef81e922a78a..42d8907bbe30 100644 --- a/src/libs/actions/connections/index.ts +++ b/src/libs/actions/connections/index.ts @@ -34,8 +34,8 @@ function removePolicyConnection(policyID: string, connectionName: PolicyConnecti const successData: OnyxUpdate[] = []; const failureData: OnyxUpdate[] = []; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = PolicyUtils.getPolicy(policyID); const supportedConnections: PolicyConnectionName[] = [CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.POLICY.CONNECTIONS.NAME.XERO]; diff --git a/src/pages/ReportChangeWorkspacePage.tsx b/src/pages/ReportChangeWorkspacePage.tsx index c70e5c79c45b..e4772fe3573a 100644 --- a/src/pages/ReportChangeWorkspacePage.tsx +++ b/src/pages/ReportChangeWorkspacePage.tsx @@ -45,8 +45,8 @@ function ReportChangeWorkspacePage({report}: ReportChangeWorkspacePageProps) { return; } Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(reportID)); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation if (isIOUReport(reportID) && isPolicyAdmin(getPolicy(policyID)) && report.ownerAccountID && !isPolicyMember(getLoginByAccountID(report.ownerAccountID), policyID)) { moveIOUReportToPolicyAndInviteSubmitter(reportID, policyID); } else if (isIOUReport(reportID) && isPolicyMember(session?.email, policyID)) { diff --git a/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx b/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx index c4395d6691e1..1caaa2d8f846 100644 --- a/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx +++ b/src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx @@ -25,8 +25,8 @@ function WorkspaceAdminRestrictedAction({policyID}: WorkspaceAdminRestrictedActi const styles = useThemeStyles(); const openAdminsReport = useCallback(() => { - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const reportID = `${PolicyUtils.getPolicy(policyID)?.chatReportIDAdmins}` ?? '-1'; Navigation.closeRHPFlow(); Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); diff --git a/src/pages/TransactionDuplicate/ReviewTaxCode.tsx b/src/pages/TransactionDuplicate/ReviewTaxCode.tsx index 7e491fa79e05..ea2561028db3 100644 --- a/src/pages/TransactionDuplicate/ReviewTaxCode.tsx +++ b/src/pages/TransactionDuplicate/ReviewTaxCode.tsx @@ -22,8 +22,8 @@ function ReviewTaxRate() { const {translate} = useLocalize(); const [reviewDuplicates] = useOnyx(ONYXKEYS.REVIEW_DUPLICATES); const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reviewDuplicates?.reportID ?? route.params.threadReportID}`); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = PolicyUtils.getPolicy(report?.policyID ?? ''); const transactionID = TransactionUtils.getTransactionID(route.params.threadReportID ?? ''); const compareResult = TransactionUtils.compareDuplicateTransactionFields(transactionID, reviewDuplicates?.reportID ?? '-1'); diff --git a/src/pages/home/report/SystemChatReportFooterMessage.tsx b/src/pages/home/report/SystemChatReportFooterMessage.tsx index 6ece8b50c6b7..75d25f3b19b7 100644 --- a/src/pages/home/report/SystemChatReportFooterMessage.tsx +++ b/src/pages/home/report/SystemChatReportFooterMessage.tsx @@ -23,8 +23,8 @@ function SystemChatReportFooterMessage() { const adminChatReportID = useMemo(() => { const adminPolicy = activePolicyID - ? // eslint-disable-next-line deprecation/deprecation - // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + ? // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation PolicyUtils.getPolicy(activePolicyID) : Object.values(policies ?? {}).find( (policy) => PolicyUtils.shouldShowPolicy(policy, false, currentUserLogin) && policy?.role === CONST.POLICY.ROLE.ADMIN && policy?.chatReportIDAdmins, diff --git a/src/pages/iou/request/step/IOURequestStepDistance.tsx b/src/pages/iou/request/step/IOURequestStepDistance.tsx index d7fbf4e44dfb..88a8a53df1cf 100644 --- a/src/pages/iou/request/step/IOURequestStepDistance.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistance.tsx @@ -148,8 +148,8 @@ function IOURequestStepDistance({ const policyReport = participants.at(0) ? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${selectedReportID}`] : report; const IOUpolicyID = getIOURequestPolicyID(transaction, policyReport); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const IOUpolicy = getPolicy(report?.policyID ?? IOUpolicyID); const policyCurrency = policy?.outputCurrency ?? getPersonalPolicy()?.outputCurrency ?? CONST.CURRENCY.USD; diff --git a/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx b/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx index fa9bf5743ad6..13a74a61f85f 100644 --- a/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx +++ b/src/pages/iou/request/step/IOURequestStepPerDiemWorkspace.tsx @@ -64,8 +64,8 @@ function IOURequestStepPerDiemWorkspace({ if (!policyExpenseReportID) { return; } - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const selectedPolicy = getPolicy(item.value, allPolicies); const perDiemUnit = getPerDiemCustomUnit(selectedPolicy); setMoneyRequestParticipants(transactionID, [ diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index 2ac5ea402eb8..48526ddc259a 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -146,8 +146,8 @@ function WorkspacesListPage() { selector: filterInactiveCards, canBeMissing: true, }); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policyToDelete = getPolicy(policyIDToDelete); const hasCardFeedOrExpensifyCard = !isEmptyObject(cardFeeds) || diff --git a/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx b/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx index 51ea70ded409..b91ece1793e7 100644 --- a/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx +++ b/src/pages/workspace/members/WorkspaceMemberNewCardPage.tsx @@ -51,8 +51,8 @@ type WorkspaceMemberNewCardPageProps = WithPolicyAndFullscreenLoadingProps & Pla function WorkspaceMemberNewCardPage({route, personalDetails}: WorkspaceMemberNewCardPageProps) { const {policyID} = route.params; - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(policyID); const workspaceAccountID = policy?.workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID; From f8032496642c51cda1966e33922a31d9c80777f3 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 6 Jun 2025 10:18:50 -0600 Subject: [PATCH 09/10] add missing comment --- src/libs/ReportUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index dd38feb7cced..0521ce4d8699 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2980,8 +2980,8 @@ function getIcons( return [domainIcon]; } - // eslint-disable-next-line deprecation/deprecation // This will get removed as part of https://github.com/Expensify/App/issues/59961 + // eslint-disable-next-line deprecation/deprecation if (isAdminRoom(report) || isAnnounceRoom(report) || isChatRoom(report) || isArchivedNonExpenseReport(report, getReportNameValuePairs(report?.reportID))) { const icons = [getWorkspaceIcon(report, policy)]; @@ -8538,7 +8538,7 @@ function canLeaveRoom(report: OnyxEntry, isPolicyEmployee: boolean): boo } const isReceiverPolicyAdmin = - // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 // eslint-disable-next-line deprecation/deprecation report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.BUSINESS ? getPolicy(report?.invoiceReceiver?.policyID)?.role === CONST.POLICY.ROLE.ADMIN : false; From fdbdf1815edcfe58655fd4e84836a7a62ae4fd7d Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 6 Jun 2025 10:23:31 -0600 Subject: [PATCH 10/10] fix eslint --- src/pages/iou/SplitExpenseEditPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/SplitExpenseEditPage.tsx b/src/pages/iou/SplitExpenseEditPage.tsx index 67a3a127eff6..d13cc4173cd4 100644 --- a/src/pages/iou/SplitExpenseEditPage.tsx +++ b/src/pages/iou/SplitExpenseEditPage.tsx @@ -38,8 +38,8 @@ function SplitExpenseEditPage({route}: SplitExpensePageProps) { const [splitExpenseDraftTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, {canBeMissing: false}); const splitExpenseDraftTransactionDetails = useMemo>(() => getTransactionDetails(splitExpenseDraftTransaction) ?? {}, [splitExpenseDraftTransaction]); - // eslint-disable-next-line deprecation/deprecation // This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850 + // eslint-disable-next-line deprecation/deprecation const policy = getPolicy(report?.policyID); const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report?.policyID}`, {canBeMissing: false}); const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${report?.policyID}`, {canBeMissing: false});