Skip to content

Commit

Permalink
[MDS-5427] Fix typo & add feature flag (#2630) (#2631)
Browse files Browse the repository at this point in the history
[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
  • Loading branch information
taraepp authored Aug 16, 2023
1 parent 5ca60be commit 7e80058
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions services/common/src/utils/featureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions services/core-web/common/models/documents/document.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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,
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
4 changes: 2 additions & 2 deletions services/minespace-web/common/models/documents/document.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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,
];
Expand Down

0 comments on commit 7e80058

Please sign in to comment.