diff --git a/src/components/AvatarWithDisplayName.tsx b/src/components/AvatarWithDisplayName.tsx index 16a0028d1d1d..3ff2c05b16e2 100644 --- a/src/components/AvatarWithDisplayName.tsx +++ b/src/components/AvatarWithDisplayName.tsx @@ -268,6 +268,11 @@ function AvatarWithDisplayName({ } if (isChatThread(report)) { + if (report?.parentReportID === conciergeReportID) { + Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.PROFILE.getRoute(CONST.ACCOUNT_ID.CONCIERGE))); + return; + } + // In an ideal situation account ID won't be 0 if (actorAccountID.current && actorAccountID.current > 0) { Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.PROFILE.getRoute(actorAccountID.current))); diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 01758446e98c..2e54f74828ae 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3884,6 +3884,9 @@ function getIconsForChatThread( if (!report?.parentReportID || !report?.parentReportActionID) { return []; } + if (report.parentReportID === conciergeReportIDOnyxConnect) { + return getIconsForParticipants([CONST.ACCOUNT_ID.CONCIERGE], personalDetails); + } const parentReportAction = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`]?.[report.parentReportActionID]; const actorAccountID = getReportActionActorAccountID(parentReportAction, report as OnyxEntry, report as OnyxEntry); const actorDetails = actorAccountID ? personalDetails?.[actorAccountID] : undefined; diff --git a/src/libs/actions/Report/index.ts b/src/libs/actions/Report/index.ts index e5000ab1329b..b4cbbed4ef21 100644 --- a/src/libs/actions/Report/index.ts +++ b/src/libs/actions/Report/index.ts @@ -445,6 +445,7 @@ type AddAttachmentWithCommentParams = { delegateAccountID: number | undefined; sidePanelContext?: SidePanelContext; conciergeReportID: string | undefined; + conciergeThreadReportID?: string; }; type MergeReportsProps = { @@ -1285,6 +1286,7 @@ function addAttachmentWithComment({ delegateAccountID, sidePanelContext, conciergeReportID, + conciergeThreadReportID, }: AddAttachmentWithCommentParams) { if (!report?.reportID) { return; @@ -1311,13 +1313,26 @@ function addAttachmentWithComment({ delegateAccountID, sidePanelContext, conciergeReportID, + conciergeThreadReportID, }); handlePlaySound(); return; } // Multiple attachments - first: combine text + first attachment as a single action - addActions({report, notifyReportID, ancestors, timezoneParam: timezone, currentUserAccountID, text, file: attachments?.at(0), isInSidePanel, delegateAccountID, conciergeReportID}); + addActions({ + report, + notifyReportID, + ancestors, + timezoneParam: timezone, + currentUserAccountID, + text, + file: attachments?.at(0), + isInSidePanel, + delegateAccountID, + conciergeReportID, + conciergeThreadReportID: attachments.length === 1 ? conciergeThreadReportID : undefined, + }); // Remaining: attachment-only actions (no text duplication) for (let i = 1; i < attachments?.length; i += 1) { diff --git a/src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts b/src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts index b3c2c6533a5d..a1062184e048 100644 --- a/src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts +++ b/src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts @@ -88,7 +88,12 @@ function useComposerSubmit(reportID: string) { clearAgentZeroProcessingIndicator(reportID, CONST.ACCOUNT_ID.CONCIERGE); } + // Concierge answers each question in its own thread. The side panel renders its own pinned report, + // so it stays in the DM rather than being sent to a thread it cannot show. + const shouldRespondInThread = reportID === conciergeReportID && !isInSidePanel && isBetaEnabled(CONST.BETAS.CONCIERGE_RESPOND_IN_THREAD); + if (attachmentFileRef.current) { + const attachmentCount = Array.isArray(attachmentFileRef.current) ? attachmentFileRef.current.length : 1; addAttachmentWithComment({ report: targetReport, notifyReportID: reportID, @@ -102,6 +107,9 @@ function useComposerSubmit(reportID: string) { delegateAccountID, sidePanelContext, conciergeReportID, + + // A send with several attachments posts one message per attachment, so it stays in the DM. + conciergeThreadReportID: shouldRespondInThread && attachmentCount === 1 ? generateReportID() : undefined, }); attachmentFileRef.current = null; return; @@ -197,10 +205,7 @@ function useComposerSubmit(reportID: string) { reportActionID: optimisticReportActionID, delegateAccountID, conciergeReportID, - - // Concierge answers each question in its own thread. The side panel renders its own pinned report, - // so it stays in the DM rather than being sent to a thread it cannot show. - conciergeThreadReportID: reportID === conciergeReportID && !isInSidePanel && isBetaEnabled(CONST.BETAS.CONCIERGE_RESPOND_IN_THREAD) ? generateReportID() : undefined, + conciergeThreadReportID: shouldRespondInThread ? generateReportID() : undefined, }); };