Skip to content

Commit b04bf60

Browse files
committed
Count single attachment array
1 parent 63996bf commit b04bf60

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/libs/actions/Report/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,20 @@ function addAttachmentWithComment({
13251325
}
13261326

13271327
// Multiple attachments - first: combine text + first attachment as a single action
1328-
addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text, file: attachments?.at(0), isInSidePanel, delegateAccountID, conciergeReportID});
1328+
// Only a lone attachment threads, since each of several attachments posts its own message.
1329+
addActions({
1330+
report,
1331+
notifyReportID,
1332+
ancestors,
1333+
timezoneParam: timezone,
1334+
currentUserAccountID,
1335+
text,
1336+
file: attachments?.at(0),
1337+
isInSidePanel,
1338+
delegateAccountID,
1339+
conciergeReportID,
1340+
conciergeThreadReportID: attachments.length === 1 ? conciergeThreadReportID : undefined,
1341+
});
13291342

13301343
// Remaining: attachment-only actions (no text duplication)
13311344
for (let i = 1; i < attachments?.length; i += 1) {

src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ function useComposerSubmit(reportID: string) {
9393
const shouldRespondInThread = reportID === conciergeReportID && !isInSidePanel && isBetaEnabled(CONST.BETAS.CONCIERGE_RESPOND_IN_THREAD);
9494

9595
if (attachmentFileRef.current) {
96+
const attachmentCount = Array.isArray(attachmentFileRef.current) ? attachmentFileRef.current.length : 1;
9697
addAttachmentWithComment({
9798
report: targetReport,
9899
notifyReportID: reportID,
@@ -108,7 +109,7 @@ function useComposerSubmit(reportID: string) {
108109
conciergeReportID,
109110

110111
// A send with several attachments posts one message per attachment, so it stays in the DM.
111-
conciergeThreadReportID: shouldRespondInThread && !Array.isArray(attachmentFileRef.current) ? generateReportID() : undefined,
112+
conciergeThreadReportID: shouldRespondInThread && attachmentCount === 1 ? generateReportID() : undefined,
112113
});
113114
attachmentFileRef.current = null;
114115
return;

0 commit comments

Comments
 (0)