From be42f63ae8f460d9bb1232e8cbd0e1e79552c736 Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Tue, 26 Aug 2025 11:38:24 -1000 Subject: [PATCH] Fallback to accountID when no mentionedAccountIDs are present for TAKECONTROL action --- src/libs/ReportActionsUtils.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 6a2ceb006bab..0008138406f0 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -2858,10 +2858,19 @@ function getUpdatedManualApprovalThresholdMessage(reportAction: OnyxEntry(reportAction: OnyxEntry) { const {mentionedAccountIDs} = getOriginalMessage(reportAction as ReportAction) ?? {}; - if (!mentionedAccountIDs?.length) { + // If mentionedAccountIDs exists and has values, use the first one + if (mentionedAccountIDs?.length) { + return translateLocal('iou.changeApprover.changedApproverMessage', {managerID: mentionedAccountIDs.at(0) ?? CONST.DEFAULT_NUMBER_ID}); + } + + // Fallback: If mentionedAccountIDs is missing (common with OldDot take control actions), + // use the actorAccountID (who performed the take control action) as the new approver + const actorAccountID = reportAction?.actorAccountID; + if (!actorAccountID) { return ''; } - return translateLocal('iou.changeApprover.changedApproverMessage', {managerID: mentionedAccountIDs.at(0) ?? CONST.DEFAULT_NUMBER_ID}); + + return translateLocal('iou.changeApprover.changedApproverMessage', {managerID: actorAccountID}); } function isCardIssuedAction(