diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 0de973a4bc60d..b5cb0796a6a79 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -9188,7 +9188,7 @@ function getAllReportActionsErrorsAndReportActionThatRequiresAttention( reportAction = getReportActionWithSmartscanError(reportActionsArray, report); } - if (!isReportArchived && report?.statusNum === CONST.REPORT.STATUS_NUM.OPEN) { + if (!isReportArchived && isReportOwner(report) && report?.statusNum === CONST.REPORT.STATUS_NUM.OPEN) { const mostRecentActiveDEWAction = getMostRecentActiveDEWSubmitFailedAction(reportActionsArray); if (mostRecentActiveDEWAction) { reportActionErrors.dewSubmitFailed = getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericCreateFailureMessage'); diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 4f287a8d154bd..34ffa23792da0 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -11841,6 +11841,7 @@ describe('ReportUtils', () => { it('should return error for DEW_SUBMIT_FAILED action on OPEN report', () => { const report = { reportID: '1', + ownerAccountID: currentUserAccountID, statusNum: CONST.REPORT.STATUS_NUM.OPEN, stateNum: CONST.REPORT.STATE_NUM.OPEN, }; @@ -11872,6 +11873,34 @@ describe('ReportUtils', () => { expect(reportAction).toEqual(dewSubmitFailedAction); }); + it('should NOT return error for DEW_SUBMIT_FAILED when current user is not the report owner', () => { + const report = { + reportID: '1', + ownerAccountID: 999, + statusNum: CONST.REPORT.STATUS_NUM.OPEN, + stateNum: CONST.REPORT.STATE_NUM.OPEN, + }; + + const dewSubmitFailedAction = { + ...createRandomReportAction(1), + reportActionID: '1', + actionName: CONST.REPORT.ACTIONS.TYPE.DEW_SUBMIT_FAILED, + created: '2025-11-21 12:00:00', + shouldShow: true, + originalMessage: { + message: 'Error message', + }, + }; + + const reportActions = { + [dewSubmitFailedAction.reportActionID]: dewSubmitFailedAction, + }; + + const {errors} = getAllReportActionsErrorsAndReportActionThatRequiresAttention(report, reportActions); + + expect(errors?.dewSubmitFailed).toBeUndefined(); + }); + it('should NOT return error for DEW_SUBMIT_FAILED if there is a more recent SUBMITTED action', () => { const report = { reportID: '1', @@ -11910,6 +11939,7 @@ describe('ReportUtils', () => { it('should return error for DEW_SUBMIT_FAILED if it is more recent than SUBMITTED action', () => { const report = { reportID: '1', + ownerAccountID: currentUserAccountID, statusNum: CONST.REPORT.STATUS_NUM.OPEN, stateNum: CONST.REPORT.STATE_NUM.OPEN, };