Skip to content

Commit d1c530c

Browse files
authored
chore: add flag to hide upload attachments (#904)
### TL;DR Adds a flag to hide Postman upload attachment feature by default. Flag will be removed after Plumbers test and verify that the feature is working as expected in production. Key considerations for flag before rolling out to all users: - Need to ensure that Plumber's S3 bucket has been whitelisted on GSIB - AWS GuardDuty scans are scanning and tagging files appropriately - Emails by Postman are using the correct attachments If the Upload attachment function is hidden after it has been released to all users, previously uploaded files will still be visible and can be removed. ### TODO Remove flag from LaunchDarkly and remove check from `packages/frontend/src/components/AttachmentSuggestions/index.tsx`
1 parent c769f06 commit d1c530c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

packages/frontend/src/components/AttachmentSuggestions/index.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ import { useQuery } from '@apollo/client'
77
import { FormControl, useDisclosure, useOutsideClick } from '@chakra-ui/react'
88
import { FormErrorMessage, FormLabel } from '@opengovsg/design-system-react'
99

10+
import { HIDE_POSTMAN_UPLOAD_ATTACHMENT_FLAG } from '@/config/flags'
11+
import { LaunchDarklyContext } from '@/contexts/LaunchDarkly'
1012
import { StepExecutionsContext } from '@/contexts/StepExecutions'
1113
import { GET_FLOW } from '@/graphql/queries/get-flow'
1214
import {
1315
extractVariables,
1416
filterVariables,
17+
StepWithVariables,
1518
type Variable,
1619
} from '@/helpers/variables'
1720
import { useS3Operations } from '@/hooks/useS3Operations'
@@ -47,6 +50,11 @@ function AttachmentSuggestions(props: AttachmentSuggestionsProps) {
4750
const { control, setError, getValues } = useFormContext()
4851
const [currentTab, setCurrentTab] = useState<number>(0)
4952

53+
// TODO (kevinkim-ogp): remove this after we confirm that upload is stable
54+
const launchDarkly = useContext(LaunchDarklyContext)
55+
const hideUploadAttachments =
56+
launchDarkly.flags?.[HIDE_POSTMAN_UPLOAD_ATTACHMENT_FLAG]
57+
5058
const flowId = getValues('flowId')
5159

5260
const {
@@ -129,15 +137,16 @@ function AttachmentSuggestions(props: AttachmentSuggestionsProps) {
129137
])
130138
return [
131139
...filteredVars,
132-
{
140+
!hideUploadAttachments && {
133141
id: 'uploaded',
134142
name: 'Uploaded attachments',
135143
output: uploadedItems,
136144
addNew: true,
137145
},
138-
]
146+
].filter(Boolean) as StepWithVariables[]
139147
}, [
140148
getValues,
149+
hideUploadAttachments,
141150
name,
142151
priorExecutionSteps,
143152
setSelectedOptions,

packages/frontend/src/config/flags.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export const SINGLE_STEP_TEST_KILL_SWITCH = 'single_step_test_kill_switch'
1616
export const BULK_RETRY_EXECUTIONS_FLAG = 'bulk-retry-failed-executions-v1'
1717
export const SGID_FEATURE_FLAG = 'sgid-login'
1818
export const NESTED_IFTHEN_FEATURE_FLAG = 'feature_nested_if_then'
19+
export const HIDE_POSTMAN_UPLOAD_ATTACHMENT_FLAG =
20+
'hide-postman-upload-attachment'
1921

2022
/**
2123
* App/events flags

0 commit comments

Comments
 (0)