-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat: deep link to report preview or message that caused GBR/RBR #85192
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
ff37968
6fc70ab
3c2f517
8b0fdb5
e3e58ad
c0694f7
966d86a
adc34fb
b4f871d
3b290e7
5b1ebb4
cfa0814
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -846,6 +846,7 @@ | |||||||||||||||||||||||||||||||||||||||
| allReportErrors?: Errors; | ||||||||||||||||||||||||||||||||||||||||
| brickRoadIndicator?: ValueOf<typeof CONST.BRICK_ROAD_INDICATOR_STATUS> | '' | null; | ||||||||||||||||||||||||||||||||||||||||
| actionBadge?: ValueOf<typeof CONST.REPORT.ACTION_BADGE>; | ||||||||||||||||||||||||||||||||||||||||
| actionTargetReportActionID?: string; | ||||||||||||||||||||||||||||||||||||||||
| tooltipText?: string | null; | ||||||||||||||||||||||||||||||||||||||||
| alternateTextMaxLines?: number; | ||||||||||||||||||||||||||||||||||||||||
| boldStyle?: boolean; | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1049,7 +1050,7 @@ | |||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| let conciergeReportIDOnyxConnect: OnyxEntry<string>; | ||||||||||||||||||||||||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||||||||||||||||||||||||
| key: ONYXKEYS.CONCIERGE_REPORT_ID, | ||||||||||||||||||||||||||||||||||||||||
| callback: (value) => { | ||||||||||||||||||||||||||||||||||||||||
| conciergeReportIDOnyxConnect = value; | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1057,7 +1058,7 @@ | |||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon'; | ||||||||||||||||||||||||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||||||||||||||||||||||||
| key: ONYXKEYS.SESSION, | ||||||||||||||||||||||||||||||||||||||||
| callback: (value) => { | ||||||||||||||||||||||||||||||||||||||||
| // When signed out, val is undefined | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1075,7 +1076,7 @@ | |||||||||||||||||||||||||||||||||||||||
| let allPersonalDetails: OnyxEntry<PersonalDetailsList>; | ||||||||||||||||||||||||||||||||||||||||
| let allPersonalDetailLogins: string[]; | ||||||||||||||||||||||||||||||||||||||||
| let currentUserPersonalDetails: OnyxEntry<PersonalDetails>; | ||||||||||||||||||||||||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||||||||||||||||||||||||
| key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||||||||||||||||||||||||||||||||||||||||
| callback: (value) => { | ||||||||||||||||||||||||||||||||||||||||
| if (currentUserAccountID) { | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1087,7 +1088,7 @@ | |||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| let allReportsDraft: OnyxCollection<Report>; | ||||||||||||||||||||||||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||||||||||||||||||||||||
| key: ONYXKEYS.COLLECTION.REPORT_DRAFT, | ||||||||||||||||||||||||||||||||||||||||
| waitForCollectionCallback: true, | ||||||||||||||||||||||||||||||||||||||||
| callback: (value) => (allReportsDraft = value), | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1095,7 +1096,7 @@ | |||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| let allPolicies: OnyxCollection<Policy>; | ||||||||||||||||||||||||||||||||||||||||
| let policiesArray: Policy[] = []; | ||||||||||||||||||||||||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||||||||||||||||||||||||
| key: ONYXKEYS.COLLECTION.POLICY, | ||||||||||||||||||||||||||||||||||||||||
| waitForCollectionCallback: true, | ||||||||||||||||||||||||||||||||||||||||
| callback: (value) => { | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1105,7 +1106,7 @@ | |||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| let allPolicyDrafts: OnyxCollection<Policy>; | ||||||||||||||||||||||||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||||||||||||||||||||||||
| key: ONYXKEYS.COLLECTION.POLICY_DRAFTS, | ||||||||||||||||||||||||||||||||||||||||
| waitForCollectionCallback: true, | ||||||||||||||||||||||||||||||||||||||||
| callback: (value) => (allPolicyDrafts = value), | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1113,7 +1114,7 @@ | |||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| let allReports: OnyxCollection<Report>; | ||||||||||||||||||||||||||||||||||||||||
| let reportsByPolicyID: ReportByPolicyMap; | ||||||||||||||||||||||||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||||||||||||||||||||||||
| key: ONYXKEYS.COLLECTION.REPORT, | ||||||||||||||||||||||||||||||||||||||||
| waitForCollectionCallback: true, | ||||||||||||||||||||||||||||||||||||||||
| callback: (value) => { | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -9091,67 +9092,51 @@ | |||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||
| * Should we display a RBR on the LHN on this report due to violations? | ||||||||||||||||||||||||||||||||||||||||
| * Returns the reportID of the first child expense report that has violations under the same policy, | ||||||||||||||||||||||||||||||||||||||||
| * or undefined if none found. Used to find the REPORT_PREVIEW action to deep-link to. | ||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||
| function shouldDisplayViolationsRBRInLHN(report: OnyxEntry<Report>, transactionViolations: OnyxCollection<TransactionViolation[]>): boolean { | ||||||||||||||||||||||||||||||||||||||||
| function getViolatingReportIDForRBRInLHN(report: OnyxEntry<Report>, transactionViolations: OnyxCollection<TransactionViolation[]>): string | null { | ||||||||||||||||||||||||||||||||||||||||
| // We only show the RBR in the highest level, which is the expense chat | ||||||||||||||||||||||||||||||||||||||||
| if (!report || !isPolicyExpenseChat(report)) { | ||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // We only show the RBR to the submitter | ||||||||||||||||||||||||||||||||||||||||
| if (!isCurrentUserSubmitter(report)) { | ||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| if (!report.policyID || !reportsByPolicyID) { | ||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // If any report has a violation, then it should have a RBR | ||||||||||||||||||||||||||||||||||||||||
| const potentialReports = Object.values(reportsByPolicyID[report.policyID] ?? {}) ?? []; | ||||||||||||||||||||||||||||||||||||||||
| return potentialReports.some((potentialReport) => { | ||||||||||||||||||||||||||||||||||||||||
| if (!potentialReport) { | ||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${potentialReport.policyID}`]; | ||||||||||||||||||||||||||||||||||||||||
| const transactions = getReportTransactions(potentialReport.reportID); | ||||||||||||||||||||||||||||||||||||||||
| const violatingReport = potentialReports | ||||||||||||||||||||||||||||||||||||||||
| // eslint-disable-next-line rulesdir/prefer-locale-compare-from-context | ||||||||||||||||||||||||||||||||||||||||
| .sort((a, b) => (a?.created ?? '').localeCompare(b?.created ?? '')) | ||||||||||||||||||||||||||||||||||||||||
| .find((potentialReport) => { | ||||||||||||||||||||||||||||||||||||||||
| if (!potentialReport) { | ||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| const policy = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${potentialReport.policyID}`]; | ||||||||||||||||||||||||||||||||||||||||
| const transactions = getReportTransactions(potentialReport.reportID); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // Allow both open and processing reports to show RBR for violations | ||||||||||||||||||||||||||||||||||||||||
| if (!isOpenOrProcessingReport(potentialReport)) { | ||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| // Allow both open and processing reports to show RBR for violations | ||||||||||||||||||||||||||||||||||||||||
| if (!isOpenOrProcessingReport(potentialReport)) { | ||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+9121
to
+9127
Contributor
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. we dont neeed to access it so early
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||
| !isInvoiceReport(potentialReport) && | ||||||||||||||||||||||||||||||||||||||||
| ViolationsUtils.hasVisibleViolationsForUser( | ||||||||||||||||||||||||||||||||||||||||
| potentialReport, | ||||||||||||||||||||||||||||||||||||||||
| transactionViolations, | ||||||||||||||||||||||||||||||||||||||||
| currentUserEmail ?? '', | ||||||||||||||||||||||||||||||||||||||||
| currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID, | ||||||||||||||||||||||||||||||||||||||||
| policy, | ||||||||||||||||||||||||||||||||||||||||
| transactions, | ||||||||||||||||||||||||||||||||||||||||
| ) && | ||||||||||||||||||||||||||||||||||||||||
| (hasViolations( | ||||||||||||||||||||||||||||||||||||||||
| potentialReport.reportID, | ||||||||||||||||||||||||||||||||||||||||
| transactionViolations, | ||||||||||||||||||||||||||||||||||||||||
| currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID, | ||||||||||||||||||||||||||||||||||||||||
| currentUserEmail ?? '', | ||||||||||||||||||||||||||||||||||||||||
| true, | ||||||||||||||||||||||||||||||||||||||||
| transactions, | ||||||||||||||||||||||||||||||||||||||||
| potentialReport, | ||||||||||||||||||||||||||||||||||||||||
| policy, | ||||||||||||||||||||||||||||||||||||||||
| ) || | ||||||||||||||||||||||||||||||||||||||||
| hasWarningTypeViolations( | ||||||||||||||||||||||||||||||||||||||||
| potentialReport.reportID, | ||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||
| !isInvoiceReport(potentialReport) && | ||||||||||||||||||||||||||||||||||||||||
| ViolationsUtils.hasVisibleViolationsForUser( | ||||||||||||||||||||||||||||||||||||||||
| potentialReport, | ||||||||||||||||||||||||||||||||||||||||
| transactionViolations, | ||||||||||||||||||||||||||||||||||||||||
| currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID, | ||||||||||||||||||||||||||||||||||||||||
| currentUserEmail ?? '', | ||||||||||||||||||||||||||||||||||||||||
| true, | ||||||||||||||||||||||||||||||||||||||||
| transactions, | ||||||||||||||||||||||||||||||||||||||||
| potentialReport, | ||||||||||||||||||||||||||||||||||||||||
| currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID, | ||||||||||||||||||||||||||||||||||||||||
| policy, | ||||||||||||||||||||||||||||||||||||||||
| ) || | ||||||||||||||||||||||||||||||||||||||||
| hasNoticeTypeViolations( | ||||||||||||||||||||||||||||||||||||||||
| transactions, | ||||||||||||||||||||||||||||||||||||||||
| ) && | ||||||||||||||||||||||||||||||||||||||||
| (hasViolations( | ||||||||||||||||||||||||||||||||||||||||
| potentialReport.reportID, | ||||||||||||||||||||||||||||||||||||||||
| transactionViolations, | ||||||||||||||||||||||||||||||||||||||||
| currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID, | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -9160,9 +9145,30 @@ | |||||||||||||||||||||||||||||||||||||||
| transactions, | ||||||||||||||||||||||||||||||||||||||||
| potentialReport, | ||||||||||||||||||||||||||||||||||||||||
| policy, | ||||||||||||||||||||||||||||||||||||||||
| )) | ||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||
| ) || | ||||||||||||||||||||||||||||||||||||||||
| hasWarningTypeViolations( | ||||||||||||||||||||||||||||||||||||||||
| potentialReport.reportID, | ||||||||||||||||||||||||||||||||||||||||
| transactionViolations, | ||||||||||||||||||||||||||||||||||||||||
| currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID, | ||||||||||||||||||||||||||||||||||||||||
| currentUserEmail ?? '', | ||||||||||||||||||||||||||||||||||||||||
| true, | ||||||||||||||||||||||||||||||||||||||||
| transactions, | ||||||||||||||||||||||||||||||||||||||||
| potentialReport, | ||||||||||||||||||||||||||||||||||||||||
| policy, | ||||||||||||||||||||||||||||||||||||||||
| ) || | ||||||||||||||||||||||||||||||||||||||||
| hasNoticeTypeViolations( | ||||||||||||||||||||||||||||||||||||||||
| potentialReport.reportID, | ||||||||||||||||||||||||||||||||||||||||
| transactionViolations, | ||||||||||||||||||||||||||||||||||||||||
| currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID, | ||||||||||||||||||||||||||||||||||||||||
| currentUserEmail ?? '', | ||||||||||||||||||||||||||||||||||||||||
| true, | ||||||||||||||||||||||||||||||||||||||||
| transactions, | ||||||||||||||||||||||||||||||||||||||||
| potentialReport, | ||||||||||||||||||||||||||||||||||||||||
| policy, | ||||||||||||||||||||||||||||||||||||||||
| )) | ||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||
| return violatingReport ? violatingReport.reportID : null; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -9393,7 +9399,7 @@ | |||||||||||||||||||||||||||||||||||||||
| let doesTransactionThreadReportHasViolations = false; | ||||||||||||||||||||||||||||||||||||||||
| if (oneTransactionThreadReportID) { | ||||||||||||||||||||||||||||||||||||||||
| const transactionReport = getReport(oneTransactionThreadReportID, allReports); | ||||||||||||||||||||||||||||||||||||||||
| doesTransactionThreadReportHasViolations = !!transactionReport && shouldDisplayViolationsRBRInLHN(transactionReport, transactionViolations); | ||||||||||||||||||||||||||||||||||||||||
| doesTransactionThreadReportHasViolations = !!transactionReport && !!getViolatingReportIDForRBRInLHN(transactionReport, transactionViolations); | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||
| doesTransactionThreadReportHasViolations || | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -12741,16 +12747,17 @@ | |||||||||||||||||||||||||||||||||||||||
| transactionViolations: OnyxCollection<TransactionViolation[]>; | ||||||||||||||||||||||||||||||||||||||||
| isReportArchived: boolean; | ||||||||||||||||||||||||||||||||||||||||
| actionBadge?: ValueOf<typeof CONST.REPORT.ACTION_BADGE>; | ||||||||||||||||||||||||||||||||||||||||
| actionTargetReportActionID?: string; | ||||||||||||||||||||||||||||||||||||||||
| }) { | ||||||||||||||||||||||||||||||||||||||||
| const reportActionsList = reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.reportID}`]; | ||||||||||||||||||||||||||||||||||||||||
| const parentReportActionsList = reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`]; | ||||||||||||||||||||||||||||||||||||||||
| const hasViolationsToDisplayInLHN = shouldDisplayViolationsRBRInLHN(report, transactionViolations); | ||||||||||||||||||||||||||||||||||||||||
| const hasViolationsToDisplayInLHN = !!getViolatingReportIDForRBRInLHN(report, transactionViolations); | ||||||||||||||||||||||||||||||||||||||||
| const hasAnyTypeOfViolations = hasViolationsToDisplayInLHN; | ||||||||||||||||||||||||||||||||||||||||
| const reportErrors = getAllReportErrors(report, reportActionsList, isReportArchived); | ||||||||||||||||||||||||||||||||||||||||
| const hasErrors = Object.entries(reportErrors ?? {}).length > 0; | ||||||||||||||||||||||||||||||||||||||||
| const oneTransactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, reportActionsList); | ||||||||||||||||||||||||||||||||||||||||
| const parentReportAction = report?.parentReportActionID ? parentReportActionsList?.[report.parentReportActionID] : undefined; | ||||||||||||||||||||||||||||||||||||||||
| const {reason, actionBadge} = getReasonAndReportActionThatRequiresAttention(report, parentReportAction, isReportArchived) ?? {}; | ||||||||||||||||||||||||||||||||||||||||
| const {reason, actionBadge, reportAction} = getReasonAndReportActionThatRequiresAttention(report, parentReportAction, isReportArchived) ?? {}; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||||||
| hasViolationsToDisplayInLHN, | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -12761,6 +12768,7 @@ | |||||||||||||||||||||||||||||||||||||||
| parentReportAction, | ||||||||||||||||||||||||||||||||||||||||
| requiresAttention: !!reason, | ||||||||||||||||||||||||||||||||||||||||
| actionBadge, | ||||||||||||||||||||||||||||||||||||||||
| actionTargetReportActionID: reportAction?.reportActionID, | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
@@ -13273,6 +13281,7 @@ | |||||||||||||||||||||||||||||||||||||||
| getDisplayedReportID, | ||||||||||||||||||||||||||||||||||||||||
| getTransactionsWithReceipts, | ||||||||||||||||||||||||||||||||||||||||
| getUserDetailTooltipText, | ||||||||||||||||||||||||||||||||||||||||
| getViolatingReportIDForRBRInLHN, | ||||||||||||||||||||||||||||||||||||||||
| getWhisperDisplayNames, | ||||||||||||||||||||||||||||||||||||||||
| getWorkspaceChats, | ||||||||||||||||||||||||||||||||||||||||
| getWorkspaceIcon, | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -13413,7 +13422,6 @@ | |||||||||||||||||||||||||||||||||||||||
| shouldDisableRename, | ||||||||||||||||||||||||||||||||||||||||
| shouldDisableThread, | ||||||||||||||||||||||||||||||||||||||||
| shouldDisplayThreadReplies, | ||||||||||||||||||||||||||||||||||||||||
| shouldDisplayViolationsRBRInLHN, | ||||||||||||||||||||||||||||||||||||||||
| shouldReportBeInOptionList, | ||||||||||||||||||||||||||||||||||||||||
| shouldReportShowSubscript, | ||||||||||||||||||||||||||||||||||||||||
| shouldShowFlagComment, | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,7 @@ import { | |
| getIntegrationSyncFailedMessage, | ||
| getInvoiceCompanyNameUpdateMessage, | ||
| getInvoiceCompanyWebsiteUpdateMessage, | ||
| getIOUReportIDFromReportActionPreview, | ||
| getLastVisibleMessage, | ||
| getMessageOfOldDotReportAction, | ||
| getOriginalMessage, | ||
|
|
@@ -151,6 +152,7 @@ import { | |
| getReportParticipantsTitle, | ||
| getReportSubtitlePrefix, | ||
| getUnreportedTransactionMessage, | ||
| getViolatingReportIDForRBRInLHN, | ||
| getWorkspaceNameUpdatedMessage, | ||
| hasReportErrorsOtherThanFailedReceipt, | ||
| isAdminRoom, | ||
|
|
@@ -182,7 +184,6 @@ import { | |
| isUnread, | ||
| isUnreadWithMention, | ||
| isWorkspaceTaskReport, | ||
| shouldDisplayViolationsRBRInLHN, | ||
| shouldReportBeInOptionList, | ||
| shouldReportShowSubscript, | ||
| } from './ReportUtils'; | ||
|
|
@@ -246,7 +247,7 @@ function shouldDisplayReportInLHN( | |
|
|
||
| // Get report metadata and status | ||
| const parentReportAction = getReportAction(report?.parentReportID, report?.parentReportActionID); | ||
| const doesReportHaveViolations = shouldDisplayViolationsRBRInLHN(report, transactionViolations); | ||
| const doesReportHaveViolations = !!getViolatingReportIDForRBRInLHN(report, transactionViolations); | ||
| const isHidden = isHiddenForCurrentUser(report); | ||
| const isFocused = report.reportID === currentReportId; | ||
| const chatReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${report?.chatReportID}`]; | ||
|
|
@@ -627,20 +628,23 @@ function getReasonAndReportActionThatHasRedBrickRoad( | |
| transactionViolations?: OnyxCollection<TransactionViolation[]>, | ||
| isReportArchived = false, | ||
| ): ReasonAndReportActionThatHasRedBrickRoad | null { | ||
| const {reportAction} = getAllReportActionsErrorsAndReportActionThatRequiresAttention(report, reportActions, isReportArchived); | ||
| const errors = reportErrors; | ||
| const hasErrors = Object.keys(errors).length !== 0; | ||
|
|
||
| if (isReportArchived) { | ||
| return null; | ||
| } | ||
|
|
||
| if (shouldDisplayViolationsRBRInLHN(report, transactionViolations)) { | ||
| const violatingReportID = getViolatingReportIDForRBRInLHN(report, transactionViolations); | ||
| if (violatingReportID) { | ||
| const reportPreviewAction = Object.values(reportActions ?? {}).find((action) => getIOUReportIDFromReportActionPreview(action) === violatingReportID); | ||
| return { | ||
| reason: CONST.RBR_REASONS.HAS_TRANSACTION_THREAD_VIOLATIONS, | ||
| reportAction: reportPreviewAction, | ||
| }; | ||
| } | ||
|
|
||
| const {reportAction} = getAllReportActionsErrorsAndReportActionThatRequiresAttention(report, reportActions, isReportArchived); | ||
|
Contributor
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. for Follow up: Since we do not care about the |
||
| const errors = reportErrors; | ||
| const hasErrors = Object.keys(errors).length !== 0; | ||
|
|
||
| if (hasErrors) { | ||
| return { | ||
| reason: CONST.RBR_REASONS.HAS_ERRORS, | ||
|
|
@@ -657,19 +661,6 @@ function getReasonAndReportActionThatHasRedBrickRoad( | |
| return getReceiptUploadErrorReason(report, chatReport, reportActions, transactions); | ||
| } | ||
|
|
||
| function shouldShowRedBrickRoad( | ||
| report: Report, | ||
| chatReport: OnyxEntry<Report>, | ||
| reportActions: OnyxEntry<ReportActions>, | ||
| hasViolations: boolean, | ||
| reportErrors: Errors, | ||
| transactions: OnyxCollection<Transaction>, | ||
| transactionViolations?: OnyxCollection<TransactionViolation[]>, | ||
| isReportArchived = false, | ||
| ) { | ||
| return !!getReasonAndReportActionThatHasRedBrickRoad(report, chatReport, reportActions, hasViolations, reportErrors, transactions, transactionViolations, isReportArchived); | ||
| } | ||
|
|
||
| /** | ||
| * Gets all the data necessary for rendering an OptionRowLHN component | ||
| */ | ||
|
|
@@ -792,6 +783,7 @@ function getOptionData({ | |
| result.pendingAction = report.pendingFields?.addWorkspaceRoom ?? report.pendingFields?.createChat; | ||
| result.brickRoadIndicator = reportAttributes?.brickRoadStatus; | ||
| result.actionBadge = reportAttributes?.actionBadge; | ||
| result.actionTargetReportActionID = reportAttributes?.actionTargetReportActionID; | ||
| result.ownerAccountID = report.ownerAccountID; | ||
| result.managerID = report.managerID; | ||
| result.reportID = report.reportID; | ||
|
|
@@ -1360,7 +1352,6 @@ export default { | |
| combineReportCategories, | ||
| getWelcomeMessage, | ||
| getReasonAndReportActionThatHasRedBrickRoad, | ||
| shouldShowRedBrickRoad, | ||
| getReportsToDisplayInLHN, | ||
| updateReportsToDisplayInLHN, | ||
| shouldDisplayReportInLHN, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.