@@ -1192,7 +1192,7 @@ function isTagModificationAction(actionName: string): boolean {
11921192 * Used for Send Money flow, which is a special case where we have no IOU create action and only one IOU pay action.
11931193 * In other reports, pay actions do not count as a transactions, but this is an exception to this rule.
11941194 */
1195- function getSendMoneyFlowOneTransactionThreadID ( actions : OnyxEntry < ReportActions > | ReportAction [ ] , chatReport : OnyxEntry < Report > ) {
1195+ function getSendMoneyFlowAction ( actions : OnyxEntry < ReportActions > | ReportAction [ ] , chatReport : OnyxEntry < Report > ) : ReportAction < 'IOU' > | undefined {
11961196 if ( ! chatReport ) {
11971197 return undefined ;
11981198 }
@@ -1212,7 +1212,7 @@ function getSendMoneyFlowOneTransactionThreadID(actions: OnyxEntry<ReportActions
12121212 // ...and can only be triggered on DM chats
12131213 const isDM = type === CONST . REPORT . TYPE . CHAT && ! chatType && ! ( parentReportID && parentReportActionID ) ;
12141214
1215- return isFirstActionPay && isDM ? iouActions . at ( 0 ) ?. childReportID : undefined ;
1215+ return isFirstActionPay && isDM ? iouActions . at ( 0 ) : undefined ;
12161216}
12171217
12181218/** Whether action has no linked report by design */
@@ -1247,16 +1247,16 @@ const isIOUActionMatchingTransactionList = (
12471247} ;
12481248
12491249/**
1250- * Gets the reportID for the transaction thread associated with a report by iterating over the reportActions and identifying the IOU report actions.
1251- * Returns a reportID if there is exactly one transaction thread for the report, and null otherwise.
1250+ * Gets the report action for the transaction thread associated with a report by iterating over the reportActions and identifying the IOU report actions.
1251+ * Returns a report action if there is exactly one transaction thread for the report, and undefined otherwise.
12521252 */
1253- function getOneTransactionThreadReportID (
1253+ function getOneTransactionThreadReportAction (
12541254 report : OnyxEntry < Report > ,
12551255 chatReport : OnyxEntry < Report > ,
12561256 reportActions : OnyxEntry < ReportActions > | ReportAction [ ] ,
12571257 isOffline : boolean | undefined = undefined ,
12581258 reportTransactionIDs ?: string [ ] ,
1259- ) : string | undefined {
1259+ ) : ReportAction < 'IOU' > | undefined {
12601260 // If the report is not an IOU, Expense report, or Invoice, it shouldn't be treated as one-transaction report.
12611261 if ( report ?. type !== CONST . REPORT . TYPE . IOU && report ?. type !== CONST . REPORT . TYPE . EXPENSE && report ?. type !== CONST . REPORT . TYPE . INVOICE ) {
12621262 return ;
@@ -1267,10 +1267,10 @@ function getOneTransactionThreadReportID(
12671267 return ;
12681268 }
12691269
1270- const sendMoneyFlowID = getSendMoneyFlowOneTransactionThreadID ( reportActions , chatReport ) ;
1270+ const sendMoneyFlow = getSendMoneyFlowAction ( reportActions , chatReport ) ;
12711271
1272- if ( sendMoneyFlowID ) {
1273- return sendMoneyFlowID ;
1272+ if ( sendMoneyFlow ?. childReportID ) {
1273+ return sendMoneyFlow ;
12741274 }
12751275
12761276 const iouRequestActions = [ ] ;
@@ -1314,8 +1314,15 @@ function getOneTransactionThreadReportID(
13141314 return ;
13151315 }
13161316
1317- // Ensure we have a childReportID associated with the IOU report action
1318- return singleAction ?. childReportID ;
1317+ return singleAction ;
1318+ }
1319+
1320+ /**
1321+ * Gets the reportID for the transaction thread associated with a report by iterating over the reportActions and identifying the IOU report actions.
1322+ * Returns a reportID if there is exactly one transaction thread for the report, and undefined otherwise.
1323+ */
1324+ function getOneTransactionThreadReportID ( ...args : Parameters < typeof getOneTransactionThreadReportAction > ) : string | undefined {
1325+ return getOneTransactionThreadReportAction ( ...args ) ?. childReportID ;
13191326}
13201327
13211328/**
@@ -2961,6 +2968,7 @@ export {
29612968 getMessageOfOldDotReportAction ,
29622969 getMostRecentIOURequestActionID ,
29632970 getNumberOfMoneyRequests ,
2971+ getOneTransactionThreadReportAction ,
29642972 getOneTransactionThreadReportID ,
29652973 getOriginalMessage ,
29662974 getAddedApprovalRuleMessage ,
@@ -3083,7 +3091,7 @@ export {
30833091 getWorkspaceDescriptionUpdatedMessage ,
30843092 getWorkspaceReportFieldAddMessage ,
30853093 getWorkspaceCustomUnitRateAddedMessage ,
3086- getSendMoneyFlowOneTransactionThreadID ,
3094+ getSendMoneyFlowAction ,
30873095 getWorkspaceTagUpdateMessage ,
30883096 getWorkspaceReportFieldUpdateMessage ,
30893097 getWorkspaceReportFieldDeleteMessage ,
0 commit comments