From 7e8005860c51d0bd9cc2d1e4318070ded8aaf7e0 Mon Sep 17 00:00:00 2001 From: Tara Epp <102187683+taraepp@users.noreply.github.com> Date: Wed, 16 Aug 2023 16:08:02 -0600 Subject: [PATCH] [MDS-5427] Fix typo & add feature flag (#2630) (#2631) [MDS-4153] Fix typo & add feature flag (#2630) * fix typo * feature flag on replace documents * fixing mistake, had set replace file flag to off, change back to prod check --- services/common/src/utils/featureFlag.ts | 2 ++ .../resources/project_summary_document_upload.py | 1 + services/core-web/common/models/documents/document.ts | 4 ++-- .../noticeOfWork/applications/review/activities/Camps.js | 2 +- .../review/activities/__snapshots__/Camps.spec.js.snap | 2 +- services/minespace-web/common/models/documents/document.ts | 4 ++-- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/services/common/src/utils/featureFlag.ts b/services/common/src/utils/featureFlag.ts index caf59bb422..864981fceb 100644 --- a/services/common/src/utils/featureFlag.ts +++ b/services/common/src/utils/featureFlag.ts @@ -2,10 +2,12 @@ import { detectProdEnvironment as IN_PROD } from "./environmentUtils"; export enum Feature { MAJOR_PROJECT_ARCHIVE_FILE, + DOCUMENTS_REPLACE_FILE, } const Flags = { [Feature.MAJOR_PROJECT_ARCHIVE_FILE]: !IN_PROD(), + [Feature.DOCUMENTS_REPLACE_FILE]: !IN_PROD(), }; /** diff --git a/services/core-api/app/api/projects/project_summary/resources/project_summary_document_upload.py b/services/core-api/app/api/projects/project_summary/resources/project_summary_document_upload.py index 0a0bb7407d..3bd336fff7 100644 --- a/services/core-api/app/api/projects/project_summary/resources/project_summary_document_upload.py +++ b/services/core-api/app/api/projects/project_summary/resources/project_summary_document_upload.py @@ -26,6 +26,7 @@ def post(self, project_guid, project_summary_guid): if not mine: raise NotFound('Mine not found') + # FEATURE FLAG: DOCUMENTS_REPLACE_FILE if Config.ENVIRONMENT_NAME != 'prod': # TODO: Remove the ENV check and else part when 5273 is ready to go live return DocumentManagerService.validateFileNameAndInitializeFileUploadWithDocumentManager( diff --git a/services/core-web/common/models/documents/document.ts b/services/core-web/common/models/documents/document.ts index 9927d81e8c..15d187c5ff 100644 --- a/services/core-web/common/models/documents/document.ts +++ b/services/core-web/common/models/documents/document.ts @@ -1,4 +1,4 @@ -import { USER_ROLES } from "@mds/common"; +import { USER_ROLES, Feature, isFeatureEnabled } from "@mds/common"; export enum FileOperations { View = "Open in document viewer", @@ -111,7 +111,7 @@ export class MineDocument { return [ this.file_type === ".pdf" && FileOperations.View, FileOperations.Download, - canModify && FileOperations.Replace, + isFeatureEnabled(Feature.DOCUMENTS_REPLACE_FILE) && canModify && FileOperations.Replace, canModify && FileOperations.Archive, canModify && FileOperations.Delete, ]; diff --git a/services/core-web/src/components/noticeOfWork/applications/review/activities/Camps.js b/services/core-web/src/components/noticeOfWork/applications/review/activities/Camps.js index 4c20699f47..a529ff170d 100644 --- a/services/core-web/src/components/noticeOfWork/applications/review/activities/Camps.js +++ b/services/core-web/src/components/noticeOfWork/applications/review/activities/Camps.js @@ -49,7 +49,7 @@ export const Camps = (props) => { validate: props.isPreLaunch ? [number] : [number, required], }, { - title: "Number of Sructures", + title: "Number of Structures", value: "number_structures", component: RenderField, minRows: 1, diff --git a/services/core-web/src/tests/components/noticeOfWork/applications/review/activities/__snapshots__/Camps.spec.js.snap b/services/core-web/src/tests/components/noticeOfWork/applications/review/activities/__snapshots__/Camps.spec.js.snap index ba1df19861..7823223b9b 100644 --- a/services/core-web/src/tests/components/noticeOfWork/applications/review/activities/__snapshots__/Camps.spec.js.snap +++ b/services/core-web/src/tests/components/noticeOfWork/applications/review/activities/__snapshots__/Camps.spec.js.snap @@ -33,7 +33,7 @@ exports[`Camps renders properly 1`] = ` Object { "component": [Function], "minRows": 1, - "title": "Number of Sructures", + "title": "Number of Structures", "validate": Array [ [Function], [Function], diff --git a/services/minespace-web/common/models/documents/document.ts b/services/minespace-web/common/models/documents/document.ts index 9927d81e8c..15d187c5ff 100644 --- a/services/minespace-web/common/models/documents/document.ts +++ b/services/minespace-web/common/models/documents/document.ts @@ -1,4 +1,4 @@ -import { USER_ROLES } from "@mds/common"; +import { USER_ROLES, Feature, isFeatureEnabled } from "@mds/common"; export enum FileOperations { View = "Open in document viewer", @@ -111,7 +111,7 @@ export class MineDocument { return [ this.file_type === ".pdf" && FileOperations.View, FileOperations.Download, - canModify && FileOperations.Replace, + isFeatureEnabled(Feature.DOCUMENTS_REPLACE_FILE) && canModify && FileOperations.Replace, canModify && FileOperations.Archive, canModify && FileOperations.Delete, ];