-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[No QA][Part 3g] Remove Onyx.connect from ModifiedExpenseMessage #83931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
accacaf
ab48b5c
ea312c1
235fd39
d56191c
f7f3706
216dc5d
3865837
e5e7664
d0d0c9c
4d71a49
a8b0aaf
b77b69b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ | |
| import {appendCountryCode, getPhoneNumberWithoutSpecialChars} from '@libs/LoginUtils'; | ||
| import {MaxHeap} from '@libs/MaxHeap'; | ||
| import {MinHeap} from '@libs/MinHeap'; | ||
| import {getForReportAction, getForReportActionTemp} from '@libs/ModifiedExpenseMessage'; | ||
| import {getForReportAction} from '@libs/ModifiedExpenseMessage'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import Parser from '@libs/Parser'; | ||
| import Permissions from '@libs/Permissions'; | ||
|
|
@@ -96,7 +96,6 @@ | |
| isPendingRemove, | ||
| isReimbursementDeQueuedOrCanceledAction, | ||
| isReimbursementQueuedAction, | ||
| isRejectedAction, | ||
| isRenamedAction, | ||
| isReportActionVisible, | ||
| isReportPreviewAction, | ||
|
|
@@ -208,7 +207,7 @@ | |
| */ | ||
|
|
||
| let allReports: OnyxCollection<Report>; | ||
| Onyx.connect({ | ||
|
Check warning on line 210 in src/libs/OptionsListUtils/index.ts
|
||
| key: ONYXKEYS.COLLECTION.REPORT, | ||
| waitForCollectionCallback: true, | ||
| callback: (value) => { | ||
|
|
@@ -220,7 +219,7 @@ | |
| const allSortedReportActions: Record<string, ReportAction[]> = {}; | ||
| const cachedOneTransactionThreadReportIDs: Record<string, string | undefined> = {}; | ||
| let allReportActions: OnyxCollection<ReportActions>; | ||
| Onyx.connect({ | ||
|
Check warning on line 222 in src/libs/OptionsListUtils/index.ts
|
||
| key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, | ||
| waitForCollectionCallback: true, | ||
| callback: (actions) => { | ||
|
|
@@ -265,7 +264,7 @@ | |
| }); | ||
|
|
||
| let activePolicyID: OnyxEntry<string>; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.NVP_ACTIVE_POLICY_ID, | ||
| callback: (value) => (activePolicyID = value), | ||
| }); | ||
|
|
@@ -421,7 +420,7 @@ | |
| option: OptionData, | ||
| {showChatPreviewLine = false, forcePolicyNamePreview = false}: PreviewConfig, | ||
| isReportArchived: boolean | undefined, | ||
| currentUserLogin: string, | ||
| currentUserAccountID: number, | ||
| // We'll make it required in the next PR. Ref: https://github.com/Expensify/App/issues/66415 | ||
| policy?: OnyxEntry<Policy>, | ||
| lastActorDetails: Partial<PersonalDetails> | null = {}, | ||
|
|
@@ -448,7 +447,6 @@ | |
| visibleReportActionsDataParam: visibleReportActionsData, | ||
| reportAttributesDerived, | ||
| policyTags, | ||
| currentUserLogin, | ||
| }); | ||
| const reportPrefix = getReportSubtitlePrefix(report); | ||
| const formattedLastMessageTextWithPrefix = reportPrefix + formattedLastMessageText; | ||
|
|
@@ -594,7 +592,6 @@ | |
| movedToReport, | ||
| policy, | ||
| isReportArchived = false, | ||
| policyForMovingExpensesID, | ||
| reportMetadata, | ||
| visibleReportActionsDataParam, | ||
| lastAction, | ||
|
|
@@ -615,7 +612,7 @@ | |
| lastAction?: OnyxEntry<ReportAction>; | ||
| reportAttributesDerived?: ReportAttributesDerivedValue['reports']; | ||
| policyTags?: OnyxEntry<PolicyTagLists>; | ||
| currentUserLogin: string; | ||
| currentUserLogin?: string; | ||
| }): string { | ||
| const reportID = report?.reportID; | ||
| const canUserPerformWrite = canUserPerformWriteAction(report, isReportArchived); | ||
|
|
@@ -725,24 +722,15 @@ | |
| } else if (isReportMessageAttachment({text: report?.lastMessageText ?? '', html: report?.lastMessageHtml, type: ''})) { | ||
| lastMessageTextFromReport = `[${translate('common.attachment')}]`; | ||
| } else if (isModifiedExpenseAction(lastReportAction)) { | ||
| const properSchemaForModifiedExpenseMessageWithHTML = policyTags | ||
| ? getForReportActionTemp({ | ||
| translate, | ||
| reportAction: lastReportAction, | ||
| policy, | ||
| movedFromReport, | ||
| movedToReport, | ||
| policyTags, | ||
| currentUserLogin, | ||
| }) | ||
| : getForReportAction({ | ||
| reportAction: lastReportAction, | ||
| policyID: report?.policyID, | ||
| movedFromReport, | ||
| movedToReport, | ||
| policyForMovingExpensesID, | ||
| currentUserLogin, | ||
| }); | ||
| const properSchemaForModifiedExpenseMessageWithHTML = getForReportAction({ | ||
| translate, | ||
| reportAction: lastReportAction, | ||
| policy, | ||
| movedFromReport, | ||
| movedToReport, | ||
| policyTags, | ||
| currentUserLogin: currentUserLogin ?? '', | ||
|
Comment on lines
+728
to
+732
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This path now always uses Useful? React with 👍 / 👎. |
||
| }); | ||
| // Strip HTML tags for plain text display in options list | ||
| const properSchemaForModifiedExpenseMessage = Parser.htmlToText(properSchemaForModifiedExpenseMessageWithHTML); | ||
| lastMessageTextFromReport = formatReportLastMessageText(properSchemaForModifiedExpenseMessage, true); | ||
|
|
@@ -791,7 +779,7 @@ | |
| } else { | ||
| lastMessageTextFromReport = translate('iou.forwarded'); | ||
| } | ||
| } else if (isRejectedAction(lastReportAction)) { | ||
| } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) { | ||
| lastMessageTextFromReport = translate('iou.rejectedThisReport'); | ||
| } else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.CORPORATE_UPGRADE) { | ||
| lastMessageTextFromReport = translate('workspaceActions.upgradedWorkspace'); | ||
|
|
@@ -1032,7 +1020,6 @@ | |
|
|
||
| // If displaying chat preview line is needed, let's overwrite the default alternate text | ||
| const lastActorDetails = personalDetails?.[report?.lastActorAccountID ?? String(CONST.DEFAULT_NUMBER_ID)] ?? {}; | ||
| const currentUserLogin = personalDetails?.[currentUserAccountID]?.login ?? ''; | ||
| // eslint-disable-next-line @typescript-eslint/no-deprecated | ||
| const translateFn = translate ?? translateLocal; | ||
| result.lastMessageText = getLastMessageTextForReport({ | ||
|
|
@@ -1043,7 +1030,6 @@ | |
| visibleReportActionsDataParam: visibleReportActionsData, | ||
| reportAttributesDerived, | ||
| policyTags, | ||
| currentUserLogin, | ||
| }); | ||
| result.alternateText = | ||
| showPersonalDetails && personalDetail?.login | ||
|
|
@@ -1052,7 +1038,7 @@ | |
| result, | ||
| {showChatPreviewLine, forcePolicyNamePreview}, | ||
| !!result.private_isArchived, | ||
| currentUserLogin, | ||
| currentUserAccountID, | ||
| // TODO: Remove this in the next PR that will refactor prepareReportOptionsForDisplay. Ref: https://github.com/Expensify/App/issues/66415 | ||
| undefined, | ||
| lastActorDetails, | ||
|
|
@@ -2236,7 +2222,7 @@ | |
| function prepareReportOptionsForDisplay( | ||
| options: Array<SearchOption<Report>>, | ||
| policiesCollection: OnyxCollection<Policy>, | ||
| currentUserLogin: string, | ||
| currentUserAccountID: number, | ||
| config: GetValidReportsConfig, | ||
| visibleReportActionsData: VisibleReportActionsDerivedValue = {}, | ||
| reportAttributesDerived?: ReportAttributesDerivedValue['reports'], | ||
|
|
@@ -2277,7 +2263,7 @@ | |
| option, | ||
| {showChatPreviewLine, forcePolicyNamePreview}, | ||
| !!option.private_isArchived, | ||
| currentUserLogin, | ||
| currentUserAccountID, | ||
| // TODO: Remove this in the next PR that will refactor prepareReportOptionsForDisplay. Ref: https://github.com/Expensify/App/issues/66415 | ||
| undefined, | ||
| null, | ||
|
|
@@ -2522,7 +2508,7 @@ | |
| selfDMChat = prepareReportOptionsForDisplay( | ||
| selfDMChats, | ||
| policiesCollection, | ||
| currentUserEmail, | ||
| currentUserAccountID, | ||
| { | ||
| ...getValidReportsConfig, | ||
| selectedOptions, | ||
|
|
@@ -2544,7 +2530,7 @@ | |
| recentReportOptions = prepareReportOptionsForDisplay( | ||
| recentReportOptions, | ||
| policiesCollection, | ||
| currentUserEmail, | ||
| currentUserAccountID, | ||
| { | ||
| ...getValidReportsConfig, | ||
| selectedOptions, | ||
|
|
@@ -2562,7 +2548,7 @@ | |
| workspaceChats = prepareReportOptionsForDisplay( | ||
| workspaceChats, | ||
| policiesCollection, | ||
| currentUserEmail, | ||
| currentUserAccountID, | ||
| { | ||
| ...getValidReportsConfig, | ||
| selectedOptions, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ CONSISTENCY-5 (docs)
The
eslint-disable-next-line @typescript-eslint/no-deprecatedon thetranslateLocalimport lacks a justification comment. Other newly added eslint-disables in this same PR include justification (e.g.,-- Onyx.connectWithoutView is being removed in ...).Add a justification explaining why the deprecated API is used:
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.