Skip to content

Commit 1690c83

Browse files
committed
fix props and money request actions list
1 parent 4ebab2d commit 1690c83

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import {
4545
shouldReportActionBeVisible,
4646
wasMessageReceivedWhileOffline,
4747
} from '@libs/ReportActionsUtils';
48-
import {canUserPerformWriteAction, chatIncludesChronosWithID, getReportLastVisibleActionCreated, isUnread} from '@libs/ReportUtils';
48+
import {canUserPerformWriteAction, chatIncludesChronosWithID, getOriginalReportID, getReportLastVisibleActionCreated, isUnread} from '@libs/ReportUtils';
4949
import markOpenReportEnd from '@libs/Telemetry/markOpenReportEnd';
5050
import {isTransactionPendingDelete} from '@libs/TransactionUtils';
5151
import Visibility from '@libs/Visibility';
@@ -146,6 +146,8 @@ function MoneyRequestReportActionsList({
146146
const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => account?.validated, canBeMissing: true});
147147
const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID, {canBeMissing: true});
148148
const personalDetails = usePersonalDetails();
149+
const [emojiReactions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}`, {canBeMissing: true});
150+
const [draftMessage] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}`, {canBeMissing: true});
149151

150152
const transactionsWithoutPendingDelete = useMemo(() => transactions.filter((t) => !isTransactionPendingDelete(t)), [transactions]);
151153
const mostRecentIOUReportActionID = useMemo(() => getMostRecentIOURequestActionID(reportActions), [reportActions]);
@@ -477,6 +479,12 @@ function MoneyRequestReportActionsList({
477479
!isConsecutiveChronosAutomaticTimerAction(visibleReportActions, index, chatIncludesChronosWithID(reportAction?.reportID)) &&
478480
hasNextActionMadeBySameActor(visibleReportActions, index);
479481

482+
const actionEmojiReactions = emojiReactions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportAction.reportActionID}`];
483+
const originalReportID = getOriginalReportID(report.reportID, reportAction);
484+
const reportDraftMessages = draftMessage?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${originalReportID}`];
485+
const matchingDraftMessage = reportDraftMessages?.[reportAction.reportActionID];
486+
const matchingDraftMessageString = typeof matchingDraftMessage === 'string' ? matchingDraftMessage : matchingDraftMessage?.message;
487+
480488
return (
481489
<ReportActionsListItemRenderer
482490
allReports={allReports}
@@ -499,6 +507,8 @@ function MoneyRequestReportActionsList({
499507
isUserValidated={isUserValidated}
500508
personalDetails={personalDetails}
501509
userBillingFundID={userBillingFundID}
510+
emojiReactions={actionEmojiReactions}
511+
draftMessage={matchingDraftMessageString}
502512
/>
503513
);
504514
},
@@ -518,6 +528,8 @@ function MoneyRequestReportActionsList({
518528
isUserValidated,
519529
personalDetails,
520530
userBillingFundID,
531+
emojiReactions,
532+
draftMessage,
521533
],
522534
);
523535

src/pages/home/report/ReportActionItemParentAction.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ type ReportActionItemParentActionProps = {
6363
shouldUseThreadDividerLine?: boolean;
6464

6565
/** User wallet */
66-
userWallet?: OnyxEntry<OnyxTypes.UserWallet>;
66+
userWallet: OnyxEntry<OnyxTypes.UserWallet>;
6767

6868
/** Whether the user is validated */
69-
isUserValidated?: boolean | undefined;
69+
isUserValidated: boolean | undefined;
7070

7171
/** Personal details list */
72-
personalDetails?: OnyxEntry<OnyxTypes.PersonalDetailsList>;
72+
personalDetails: OnyxEntry<OnyxTypes.PersonalDetailsList>;
7373

7474
/** Draft message for the report action */
7575
draftMessage?: string;
@@ -81,7 +81,7 @@ type ReportActionItemParentActionProps = {
8181
linkedTransactionRouteError?: OnyxEntry<Errors>;
8282

8383
/** User billing fund ID */
84-
userBillingFundID?: number;
84+
userBillingFundID: number | undefined;
8585
};
8686

8787
function ReportActionItemParentAction({

0 commit comments

Comments
 (0)