Skip to content

Commit

Permalink
Merge pull request #39474 from nkdengineer/fix/39420
Browse files Browse the repository at this point in the history
Fix cannot clear error of modified action in one transaction report
  • Loading branch information
NikkiWines authored Apr 3, 2024
2 parents 330dfef + 4aeafee commit c736009
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ function isMoneyRequestReport(reportOrID: OnyxEntry<Report> | EmptyObject | stri
* Checks if a report has only one transaction associated with it
*/
function isOneTransactionReport(reportID: string): boolean {
const reportActions = reportActionsByReport?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`] ?? ([] as ReportAction[]);
const reportActions = reportActionsByReport?.[reportID] ?? ([] as ReportAction[]);
return ReportActionsUtils.getOneTransactionThreadReportID(reportActions) !== null;
}

Expand Down Expand Up @@ -4993,7 +4993,12 @@ function canUserPerformWriteAction(report: OnyxEntry<Report>) {
* Returns ID of the original report from which the given reportAction is first created.
*/
function getOriginalReportID(reportID: string, reportAction: OnyxEntry<ReportAction>): string | undefined {
const currentReportAction = ReportActionsUtils.getReportAction(reportID, reportAction?.reportActionID ?? '');
const reportActions = reportActionsByReport?.[reportID];
const currentReportAction = reportActions?.[reportAction?.reportActionID ?? ''] ?? null;
const transactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(reportActions ?? ([] as ReportAction[]));
if (transactionThreadReportID !== null) {
return Object.keys(currentReportAction ?? {}).length === 0 ? transactionThreadReportID : reportID;
}
return isThreadFirstChat(reportAction, reportID) && Object.keys(currentReportAction ?? {}).length === 0
? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.parentReportID
: reportID;
Expand Down

0 comments on commit c736009

Please sign in to comment.