Skip to content

Commit

Permalink
prevent showing greendot with archived parent report
Browse files Browse the repository at this point in the history
  • Loading branch information
hungvu193 committed Sep 20, 2023
1 parent e1c1fb3 commit f593278
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,17 @@ function getDisplayNamesWithTooltips(personalDetailsList, isMultipleParticipantR
});
}

/**
* Get the report given a reportID
*
* @param {String} reportID
* @returns {Object}
*/
function getReport(reportID) {
// Deleted reports are set to null and lodashGet will still return null in that case, so we need to add an extra check
return lodashGet(allReports, `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {}) || {};
}

/**
* Determines if a report has an IOU that is waiting for an action from the current user (either Pay or Add a credit bank account)
*
Expand All @@ -1182,6 +1193,10 @@ function isWaitingForIOUActionFromCurrentUser(report) {
return false;
}

if (isArchivedRoom(getReport(report.parentReportID))) {
return false;
}

const policy = getPolicy(report.policyID);
if (policy.type === CONST.POLICY.TYPE.CORPORATE) {
// If the report is already settled, there's no action required from any user.
Expand Down Expand Up @@ -1299,17 +1314,6 @@ function getMoneyRequestReportName(report, policy = undefined) {
return payerPaidAmountMesssage;
}

/**
* Get the report given a reportID
*
* @param {String} reportID
* @returns {Object}
*/
function getReport(reportID) {
// Deleted reports are set to null and lodashGet will still return null in that case, so we need to add an extra check
return lodashGet(allReports, `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {}) || {};
}

/**
* Gets transaction created, amount, currency and comment
*
Expand Down

0 comments on commit f593278

Please sign in to comment.