-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix - Scan receipt - Red dot missing on LHN after receipt edit & submit with higher Amount #60867
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
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 |
---|---|---|
|
@@ -816,7 +816,7 @@ type GetReportNameParams = { | |
policies?: SearchPolicy[]; | ||
}; | ||
|
||
type ReportByPolicyMap = Record<string, Report[]>; | ||
type ReportByPolicyMap = Record<string, string[]>; | ||
|
||
let currentUserEmail: string | undefined; | ||
let currentUserPrivateDomain: string | undefined; | ||
|
@@ -888,7 +888,7 @@ Onyx.connect({ | |
}); | ||
|
||
let allReports: OnyxCollection<Report>; | ||
let reportsByPolicyID: ReportByPolicyMap; | ||
let reportIDsByPolicyID: ReportByPolicyMap; | ||
Onyx.connect({ | ||
key: ONYXKEYS.COLLECTION.REPORT, | ||
waitForCollectionCallback: true, | ||
|
@@ -905,7 +905,7 @@ Onyx.connect({ | |
return; | ||
} | ||
|
||
reportsByPolicyID = Object.values(value).reduce<ReportByPolicyMap>((acc, report) => { | ||
reportIDsByPolicyID = Object.values(value).reduce<ReportByPolicyMap>((acc, report) => { | ||
if (!report) { | ||
return acc; | ||
} | ||
|
@@ -914,13 +914,13 @@ Onyx.connect({ | |
|
||
// Get all reports, which are the ones that are: | ||
// - Owned by the same user | ||
// - Are either open or submitted | ||
// - Are not settled. | ||
// - Belong to the same workspace | ||
if (report.policyID && report.ownerAccountID === currentUserAccountID && (report.stateNum ?? 0) <= 1) { | ||
if (report.policyID && report.ownerAccountID === currentUserAccountID && !isSettled(report)) { | ||
if (!acc[report.policyID]) { | ||
acc[report.policyID] = []; | ||
} | ||
acc[report.policyID].push(report); | ||
acc[report.policyID].push(report.reportID); | ||
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. Do you have any explanation for using reportID instead of report? 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. Its just refactoring @hungvu193 As we are using only the report id no need to save the whole report data. 👍 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. I see. Can you merge main again? |
||
} | ||
|
||
return acc; | ||
|
@@ -7497,17 +7497,17 @@ function shouldDisplayViolationsRBRInLHN(report: OnyxEntry<Report>, transactionV | |
if (!isCurrentUserSubmitter(report.reportID)) { | ||
return false; | ||
} | ||
if (!report.policyID || !reportsByPolicyID) { | ||
if (!report.policyID || !reportIDsByPolicyID) { | ||
return false; | ||
} | ||
|
||
// If any report has a violation, then it should have a RBR | ||
const potentialReports = reportsByPolicyID[report.policyID] ?? []; | ||
return potentialReports.some((potentialReport) => { | ||
const potentialReportIDs = reportIDsByPolicyID[report.policyID] ?? []; | ||
return potentialReportIDs.some((reportID) => { | ||
return ( | ||
hasViolations(potentialReport.reportID, transactionViolations, true) || | ||
hasWarningTypeViolations(potentialReport.reportID, transactionViolations, true) || | ||
hasNoticeTypeViolations(potentialReport.reportID, transactionViolations, true) | ||
hasViolations(reportID, transactionViolations, true) || | ||
hasWarningTypeViolations(reportID, transactionViolations, true) || | ||
hasNoticeTypeViolations(reportID, transactionViolations, true) | ||
); | ||
}); | ||
} | ||
|
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.
So if I'm a submitter on a workspace that has both approvals and payments enabled. And I submit an expense that has this violation and it gets approved, but hasn't been paid yet, will I still see the RBR on my workspace chat?
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.
Yes it will only disappear after it is paid out.