From f59327892bf5b83ecb36efdd68aa6555daaf7950 Mon Sep 17 00:00:00 2001 From: Hans Date: Wed, 20 Sep 2023 14:16:04 +0700 Subject: [PATCH] prevent showing greendot with archived parent report --- src/libs/ReportUtils.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 7c807112613c..dfb2f721b47c 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -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) * @@ -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. @@ -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 *