From 0e702e82505178cbf1c27cd839d9b0992c345282 Mon Sep 17 00:00:00 2001 From: NJ-2020 Date: Sat, 26 Oct 2024 22:14:03 -0700 Subject: [PATCH 1/3] fix report preview optimistic actorAccountID --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 223e94e0bdde..dc917ed497fb 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5065,7 +5065,7 @@ function buildOptimisticReportPreview( created, accountID: iouReport?.managerID ?? -1, // The preview is initially whispered if created with a receipt, so the actor is the current user as well - actorAccountID: hasReceipt ? currentUserAccountID : iouReport?.managerID ?? -1, + actorAccountID: hasReceipt ? currentUserAccountID : isInvoiceReport(iouReport) ? iouReport.ownerAccountID : iouReport?.managerID ?? -1, childReportID: childReportID ?? iouReport?.reportID, childMoneyRequestCount: 1, childLastMoneyRequestComment: comment, From ffa5ed86dcaf03f550193fefa3355fc1bfc4a1b2 Mon Sep 17 00:00:00 2001 From: NJ-2020 Date: Sat, 26 Oct 2024 23:15:45 -0700 Subject: [PATCH 2/3] fix eslint error --- src/libs/ReportUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index dc917ed497fb..996aa4002102 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5046,6 +5046,7 @@ function buildOptimisticReportPreview( const hasReceipt = TransactionUtils.hasReceipt(transaction); const message = getReportPreviewMessage(iouReport); const created = DateUtils.getDBTime(); + const reportActorAccountID = isInvoiceReport(iouReport) ? iouReport.ownerAccountID : iouReport?.managerID ?? -1; return { reportActionID: reportActionID ?? NumberUtils.rand64(), reportID: chatReport?.reportID, @@ -5065,7 +5066,7 @@ function buildOptimisticReportPreview( created, accountID: iouReport?.managerID ?? -1, // The preview is initially whispered if created with a receipt, so the actor is the current user as well - actorAccountID: hasReceipt ? currentUserAccountID : isInvoiceReport(iouReport) ? iouReport.ownerAccountID : iouReport?.managerID ?? -1, + actorAccountID: hasReceipt ? currentUserAccountID : reportActorAccountID, childReportID: childReportID ?? iouReport?.reportID, childMoneyRequestCount: 1, childLastMoneyRequestComment: comment, From 9cbbd2b27cbfb9ebf75d78852cbeb5abd53f37da Mon Sep 17 00:00:00 2001 From: Novell <76243292+NJ-2020@users.noreply.github.com> Date: Mon, 28 Oct 2024 03:03:57 -0700 Subject: [PATCH 3/3] update reportActorAccountID variable Co-authored-by: Vinh Hoang --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 996aa4002102..bbaacdcdb7cb 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5046,7 +5046,7 @@ function buildOptimisticReportPreview( const hasReceipt = TransactionUtils.hasReceipt(transaction); const message = getReportPreviewMessage(iouReport); const created = DateUtils.getDBTime(); - const reportActorAccountID = isInvoiceReport(iouReport) ? iouReport.ownerAccountID : iouReport?.managerID ?? -1; + const reportActorAccountID = (isInvoiceReport(iouReport) ? iouReport?.ownerAccountID : iouReport?.managerID) ?? -1; return { reportActionID: reportActionID ?? NumberUtils.rand64(), reportID: chatReport?.reportID,