Repository navigation
Closed
Labels
Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionDailyKSv2KSv2EngineeringNewFeatureSomething to build that is a new item.Something to build that is a new item.
Description
- Design Doc
- Implementation should look like code snippet below
- Which probably means we should connect ReportUtils to the BETAS onyx collection
- Let's also connect it to the TRANSACTION_VIOLATIONS and REPORT_ACTIONS Onyx collections as shown below
- And let's also add as shown below
ReportUtils.reportHasViolations
- Then let's use
ReportUtils.transactionThreadHasViolations- In
SidebarUtils.tsLet's update this- From:
result.brickRoadIndicator = Object.keys(result.allReportErrors ?? {}).length !== 0 ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''; - To:
result.brickRoadIndicator = Object.keys(result.allReportErrors ?? {}).length !== 0 || ReportUtils.transactionThreadHasViolations(report) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''; - That way src/components/LHNOptionsList/OptionRowLHN.js should show the RBR
- From:
- In ReportUtils.shouldReportBeInOptionList above if (isInGSDMode) { we’ll add the if in the snippet below to surface the iou reports with violations on the LHN
- In
- And let's use
ReportUtils.reportHasViolations- In
src/components/ReportActionItem/ReportPreview.jslet's update the code so the hasErrors value takes into account the report violationsconst hasErrors = (hasReceipts && ReportUtils.hasMissingSmartscanFields(props.iouReportID)) || ReportUtils.reportHasViolations(props.iouReportID);
- In
const transactionViolations = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
callback: (violations, key) => {
if (!key || !violations) {
return;
}
const transactionID = CollectionUtils.extractCollectionItemID(key);
transactionViolations[transactionID] = violations;
},
});
const reportActions = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
callback: (actions, key) => {
if (!key || !actions) {
return;
}
const reportID = CollectionUtils.extractCollectionItemID(key);
reportActions[reportID] = actions;
},
});function transactionThreadHasViolations(report) {
if (!permissions.canUseViolations()) {
return false;
}
if (!report.parentReportActionID ?? 0) {
return false;
}
const parentReportAction = lodashGet(reportActions, `${report.parentReportID}.${report.parentReportActionID}`);
if (!parentReportAction) {
return false;
}
const transactionID = parentReportAction['originalMessage']['IOUTransactionID'] ?? 0;
if (!transactionID) {
return false;
}
const reportID = parentReportAction['originalMessage']['IOUReportID'] ?? 0;
if (!reportID) {
return false;
}
if (!isCurrentUserSubmitter(reportID)) {
return false;
}
return transactionHasViolation(transactionID);
}function transactionHasViolation(transactionID) {
const violations = lodashGet(transactionViolations, transactionID, []);
return _.some(violations, violation => violation.type === 'violation');
}function reportHasViolations(reportID) {
let transactions = TransactionUtils.getAllReportTransactions(reportID);
return _.some(transactions, (transaction) => transactionHasViolation(transaction.transactionID));
}// Always show IOU reports with violations
if (isExpenseRequest(report) && transactionThreadHasViolations(report)) {
return true;
}Metadata
Metadata
Assignees
Labels
Awaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to productionDailyKSv2KSv2EngineeringNewFeatureSomething to build that is a new item.Something to build that is a new item.
Activity
cead22 commentedon Nov 9, 2023
@lindboe @cdanwards can you please comment here so I can assign you?
cdanwards commentedon Nov 10, 2023
Commenting for assignment
melvin-bot commentedon Nov 14, 2023
@cdanwards Whoops! This issue is 2 days overdue. Let's get this updated quick!
cdanwards commentedon Nov 15, 2023
Beginning work on this now.
melvin-bot commentedon Nov 21, 2023
@cdanwards Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Nov 23, 2023
@cdanwards Still overdue 6 days?! Let's take care of this!
melvin-bot commentedon Nov 27, 2023
@cdanwards 10 days overdue. I'm getting more depressed than Marvin.
cdanwards commentedon Nov 27, 2023
Still working on this. Getting some clarification after
ReportUtilsgot swapped to TS.50 remaining items
melvin-bot commentedon Feb 23, 2024
Triggered auto assignment to @strepanier03 (
NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details.cead22 commentedon Feb 23, 2024
@strepanier03 can you please handle payment to @situchan for the PR review, and please make it double the standard amount we pay for these. This was was a pretty complex review and this is something I offered @situchan last month to put the review at the top of the priority list. Thanks
strepanier03 commentedon Mar 1, 2024
Will do @cead22!
strepanier03 commentedon Mar 1, 2024
@situchan - An offer has been sent. I'll check later today to finish paying out and closing up.
strepanier03 commentedon Mar 4, 2024
Paid and contract closed. Thanks everyone!
[-][HOLD for payment 2024-01-28] Implement and use ReportUtils.transactionThreadHasViolations(report)[/-][+][PAID] Implement and use ReportUtils.transactionThreadHasViolations(report)[/+]