diff --git a/src/libs/NextStepUtils.ts b/src/libs/NextStepUtils.ts index f03c34b1696e..0a5cfad2d146 100644 --- a/src/libs/NextStepUtils.ts +++ b/src/libs/NextStepUtils.ts @@ -73,7 +73,7 @@ function buildNextStep( const {policyID = '', ownerAccountID = -1, managerID = -1} = report; const policy = ReportUtils.getPolicy(policyID); - const {submitsTo, harvesting, isPreventSelfApprovalEnabled, preventSelfApprovalEnabled, autoReportingFrequency, autoReportingOffset} = policy; + const {submitsTo, harvesting, isPreventSelfApprovalEnabled, preventSelfApproval, autoReportingFrequency, autoReportingOffset} = policy; const isOwner = currentUserAccountID === ownerAccountID; const isManager = currentUserAccountID === managerID; const isSelfApproval = currentUserAccountID === submitsTo; @@ -164,7 +164,7 @@ function buildNextStep( } // Prevented self submitting - if ((isPreventSelfApprovalEnabled ?? preventSelfApprovalEnabled) && isSelfApproval) { + if ((isPreventSelfApprovalEnabled ?? preventSelfApproval) && isSelfApproval) { optimisticNextStep.message = [ { text: "Oops! Looks like you're submitting to ", diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index b005a9d2756f..115a913fc0f2 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -141,7 +141,7 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback< isPreventSelfApprovalEnabled?: boolean; /** Whether the self approval or submitting is enabled */ - preventSelfApprovalEnabled?: boolean; + preventSelfApproval?: boolean; /** When the monthly scheduled submit should happen */ autoReportingOffset?: AutoReportingOffset; diff --git a/tests/unit/NextStepUtilsTest.ts b/tests/unit/NextStepUtilsTest.ts index 622881bc7979..79b6985ed94a 100644 --- a/tests/unit/NextStepUtilsTest.ts +++ b/tests/unit/NextStepUtilsTest.ts @@ -340,7 +340,7 @@ describe('libs/NextStepUtils', () => { return Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, { submitsTo: currentUserAccountID, - preventSelfApprovalEnabled: true, + preventSelfApproval: true, }).then(() => { const result = NextStepUtils.buildNextStep(report, CONST.REPORT.STATUS_NUM.OPEN); diff --git a/tests/utils/LHNTestUtils.tsx b/tests/utils/LHNTestUtils.tsx index 80f28002f975..85c2d67f80bc 100644 --- a/tests/utils/LHNTestUtils.tsx +++ b/tests/utils/LHNTestUtils.tsx @@ -260,7 +260,7 @@ function getFakePolicy(id = '1', name = 'Workspace-Test-001'): Policy { enabled: true, }, autoReportingOffset: 1, - preventSelfApprovalEnabled: true, + preventSelfApproval: true, submitsTo: 123456, defaultBillable: false, disabledFields: {defaultBillable: true, reimbursable: false}, diff --git a/tests/utils/collections/policies.ts b/tests/utils/collections/policies.ts index ba5108d49481..8dd04f4750a9 100644 --- a/tests/utils/collections/policies.ts +++ b/tests/utils/collections/policies.ts @@ -14,7 +14,7 @@ export default function createRandomPolicy(index: number): Policy { enabled: randBoolean(), }, autoReportingOffset: 1, - preventSelfApprovalEnabled: randBoolean(), + preventSelfApproval: randBoolean(), submitsTo: index, outputCurrency: randCurrencyCode(), role: rand(Object.values(CONST.POLICY.ROLE)),