From 0e3844d5e549f2a3c75a0a28c62de0273efefee3 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Wed, 28 Feb 2024 21:46:31 +0000 Subject: [PATCH 1/3] Add features properties to policy --- src/types/onyx/Policy.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index cf242311dd63..7f7f1cb507cc 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -229,6 +229,24 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback< /** All the integration connections attached to the policy */ connections?: Record; + + /** Whether the Categories feature is enabled */ + areCategoriesEnabled?: boolean; + + /** Whether the Tags feature is enabled */ + areTagsEnabled?: boolean; + + /** Whether the Distance Rates feature is enabled */ + areDistanceRatessEnabled?: boolean; + + /** Whether the workflows feature is enabled */ + areWorkflowsEnabled?: boolean; + + /** Whether the Report Fields feature is enabled */ + areReportFieldsEnabled?: boolean; + + /** Whether the Connections feature is enabled */ + areConnectionsEnabled?: boolean; }, 'generalSettings' | 'addWorkspaceRoom' >; From cd3d3e99d0376231d1dca16d3206dc00300fe610 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Wed, 28 Feb 2024 21:50:58 +0000 Subject: [PATCH 2/3] Make sure the newly created workspaces have the correct default values for the features --- src/libs/actions/Policy.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index e1da946e81d8..57dfe339d6a7 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -1402,6 +1402,12 @@ function createWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policyName outputCurrency, pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, customUnits, + areCategoriesEnabled: true, + areTagsEnabled: false, + areDistanceRatessEnabled: false, + areWorkflowsEnabled: false, + areReportFieldsEnabled: false, + areConnectionsEnabled: false, }, }, { @@ -1803,6 +1809,12 @@ function createWorkspaceFromIOUPayment(iouReport: Report | EmptyObject): string outputCurrency: CONST.CURRENCY.USD, pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, customUnits, + areCategoriesEnabled: true, + areTagsEnabled: false, + areDistanceRatessEnabled: false, + areWorkflowsEnabled: false, + areReportFieldsEnabled: false, + areConnectionsEnabled: false, }; const optimisticData: OnyxUpdate[] = [ From 253366eaf03708121f13f750525c138b54b71607 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Wed, 28 Feb 2024 22:14:48 +0000 Subject: [PATCH 3/3] fix typo --- src/libs/actions/Policy.ts | 4 ++-- src/types/onyx/Policy.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 57dfe339d6a7..41288ce5eecd 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -1404,7 +1404,7 @@ function createWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policyName customUnits, areCategoriesEnabled: true, areTagsEnabled: false, - areDistanceRatessEnabled: false, + areDistanceRatesEnabled: false, areWorkflowsEnabled: false, areReportFieldsEnabled: false, areConnectionsEnabled: false, @@ -1811,7 +1811,7 @@ function createWorkspaceFromIOUPayment(iouReport: Report | EmptyObject): string customUnits, areCategoriesEnabled: true, areTagsEnabled: false, - areDistanceRatessEnabled: false, + areDistanceRatesEnabled: false, areWorkflowsEnabled: false, areReportFieldsEnabled: false, areConnectionsEnabled: false, diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 7f7f1cb507cc..1eece2d3a1e0 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -237,7 +237,7 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback< areTagsEnabled?: boolean; /** Whether the Distance Rates feature is enabled */ - areDistanceRatessEnabled?: boolean; + areDistanceRatesEnabled?: boolean; /** Whether the workflows feature is enabled */ areWorkflowsEnabled?: boolean;