Skip to content

Commit

Permalink
Merge pull request #7483 from opengovsg/release_v6.133.0
Browse files Browse the repository at this point in the history
build: release v6.133.0
  • Loading branch information
KenLSM authored Jul 8, 2024
2 parents bfa5421 + 0c7086b commit c44a8cc
Show file tree
Hide file tree
Showing 74 changed files with 1,710 additions and 2,144 deletions.
1 change: 0 additions & 1 deletion .ebextensions/01env-file-aws-ssm.config
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ files:
aws ssm get-parameter --name "${ENV_TYPE}-turnstile" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_TYPE}-ga" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_TYPE}-intranet" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_TYPE}-sentry" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_TYPE}-sms" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_TYPE}-ndi" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
aws ssm get-parameter --name "${ENV_TYPE}-verified-fields" --with-decryption --region $AWS_REGION | jq -r '.Parameter.Value' >> $TARGET_DIR/.env
Expand Down
11 changes: 7 additions & 4 deletions .template-env
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ FORMSG_SDK_MODE=
# GOOGLE_CAPTCHA=
# GOOGLE_CAPTCHA_PUBLIC=

## Sentry
## If the below variable exists, the [sentry] feature will be enabled.
# SENTRY_CONFIG_URL=

## Keys for storage mode
# If forking this repository, you will also need to fork @opengovsg/formsg-sdk
Expand Down Expand Up @@ -117,4 +114,10 @@ FORMSG_SDK_MODE=
# Used to check if BE Server is currently running on local development environment
# One of boolean: "true" | "false"
# USE_MOCK_TWILIO=
# USE_MOCK_POSTMAN_SMS=
# USE_MOCK_POSTMAN_SMS=

# POSTMAN_MOP_CAMPAIGN_ID=
# POSTMAN_MOP_CAMPAIGN_API_KEY=
# POSTMAN_INTERNAL_CAMPAIGN_ID=
# POSTMAN_INTERNAL_CAMPAIGN_API_KEY=
# POSTMAN_BASE_URL=https://test.postman.gov.sg/api/v2
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,31 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v6.133.0](https://github.com/opengovsg/FormSG/compare/v6.132.0...v6.133.0)

- feat(btn): frm 1723 internal flow postman [`#7343`](https://github.com/opengovsg/FormSG/pull/7343)
- chore(deps): bump next and react-email in /react-email-preview [`#7375`](https://github.com/opengovsg/FormSG/pull/7375)
- feat: rename placeholder for logic and mrf components [`#7482`](https://github.com/opengovsg/FormSG/pull/7482)
- chore(deps): remove sentry [`#7480`](https://github.com/opengovsg/FormSG/pull/7480)
- fix(reddot): hide on mrf [`#7481`](https://github.com/opengovsg/FormSG/pull/7481)
- feat(admin-dashboard): add response mode text next to form title on dashboard [`#7462`](https://github.com/opengovsg/FormSG/pull/7462)
- fix(deps): bump jsdom from 21.1.1 to 24.1.0 [`#7345`](https://github.com/opengovsg/FormSG/pull/7345)
- chore(deps-dev): bump @types/jsonwebtoken from 8.5.9 to 9.0.6 [`#7478`](https://github.com/opengovsg/FormSG/pull/7478)
- feat: add reddot on email noti [`#7463`](https://github.com/opengovsg/FormSG/pull/7463)
- chore(privacy policy): update clause 6.3 [`#7477`](https://github.com/opengovsg/FormSG/pull/7477)
- fix(deps): bump uuid and @types/uuid [`#7467`](https://github.com/opengovsg/FormSG/pull/7467)
- feat: add reddot to mrf workflow [`#7428`](https://github.com/opengovsg/FormSG/pull/7428)
- refactor: generalize user seen flag [`#7422`](https://github.com/opengovsg/FormSG/pull/7422)
- feat: add pdf attachments for encrypt forms [`#7470`](https://github.com/opengovsg/FormSG/pull/7470)
- build: merge release v6.132.0 to develop [`#7474`](https://github.com/opengovsg/FormSG/pull/7474)
- build: release v6.132.0 [`#7473`](https://github.com/opengovsg/FormSG/pull/7473)
- add reddot to mrf workflow [`a044b80`](https://github.com/opengovsg/FormSG/commit/a044b805076b6ad14b44fd7baf7c2d73ba73bddc)
- handle old last seen route [`d883952`](https://github.com/opengovsg/FormSG/commit/d883952df327928e92d007c46fae427851a5dc7a)

#### [v6.132.0](https://github.com/opengovsg/FormSG/compare/v6.131.0...v6.132.0)

> 4 July 2024

- chore: remove nric mask toggle if nricmask is false [`#7472`](https://github.com/opengovsg/FormSG/pull/7472)
- fix(deps): bump type-fest from 4.20.1 to 4.21.0 in /shared [`#7468`](https://github.com/opengovsg/FormSG/pull/7468)
- fix(deps): bump @babel/runtime from 7.24.1 to 7.24.7 [`#7466`](https://github.com/opengovsg/FormSG/pull/7466)
Expand All @@ -16,6 +39,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fix(encrypt-submission): add missing ndi response fields [`#7425`](https://github.com/opengovsg/FormSG/pull/7425)
- build: merge release v6.131.0 to develop [`#7460`](https://github.com/opengovsg/FormSG/pull/7460)
- build: release v6.131.0 [`#7459`](https://github.com/opengovsg/FormSG/pull/7459)
- chore: bump version to v6.132.0 [`82da6ac`](https://github.com/opengovsg/FormSG/commit/82da6acb265f9ddfbcaac07f2475c9418b633976)

#### [v6.131.0](https://github.com/opengovsg/FormSG/compare/v6.130.1...v6.131.0)

Expand Down
6 changes: 3 additions & 3 deletions __tests__/setup/.test-env
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ IS_CP_MAINTENANCE=Date/Time-CP
GOOGLE_CAPTCHA=123456789
GOOGLE_CAPTCHA_PUBLIC=987654321

GA_TRACKING_ID=UA-123456789-0
SENTRY_CONFIG_URL=https://[email protected]/1234567
CSP_REPORT_URI=https://[email protected]/1234567
GA_TRACKING_ID=UA-123456789-0

TWILIO_ACCOUNT_SID=ACrandomTwilioSid
TWILIO_API_KEY=SKrandomTwilioAPIKEY
Expand Down Expand Up @@ -93,4 +91,6 @@ SSM_ENV_SITE_NAME=test
API_KEY_VERSION=v1
POSTMAN_MOP_CAMPAIGN_ID=campaign_tesst
POSTMAN_MOP_CAMPAIGN_API_KEY=key_test_123
POSTMAN_INTERNAL_CAMPAIGN_ID=campaign_tesst
POSTMAN_INTERNAL_CAMPAIGN_API_KEY=key_test_123
POSTMAN_BASE_URL=https://test.postman.gov.sg/api/v2
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ services:
- SES_HOST=maildev
- WEBHOOK_SQS_URL=http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/local-webhooks-sqs-main
- INTRANET_IP_LIST_PATH
- SENTRY_CONFIG_URL=https://[email protected]/123456
- CSP_REPORT_URI=https://[email protected]/123456
# This needs to be removed and replaced with a real tracking ID in a local .env file
# in order to enable GA in a local environment
# TODO: remove after React rollout #4786
Expand Down Expand Up @@ -135,6 +133,8 @@ services:
- WOGAA_FEEDBACK_ENDPOINT
- POSTMAN_MOP_CAMPAIGN_ID=campaign_test
- POSTMAN_MOP_CAMPAIGN_API_KEY=key_test_123
- POSTMAN_INTERNAL_CAMPAIGN_ID=campaign_test_2
- POSTMAN_INTERNAL_CAMPAIGN_API_KEY=key_test_456
- POSTMAN_BASE_URL=https://test.postman.gov.sg/api/v2

mockpass:
Expand Down
32 changes: 16 additions & 16 deletions docs/DEPLOYMENT_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,20 @@ If no `msgSrvcName` is found in the form document, SMSes associated with that fo
### Github Actions Secrets

The following repository secrets are set in Github Actions:
| Secret | Description|
|:---------|------------|
|`AWS_ACCESS_KEY_ID`|AWS IAM access key ID used to deploy.|
|`AWS_SECRET_ACCESS_KEY`|AWS IAM access secret used to deploy.|
|`AWS_DEFAULT_REGION`|AWS region to use.|
|`ECR_REPO`|ECR Repository which stores the docker images.|
|`BUCKET_NAME`| S3 Bucket used to store zipped `Dockerrun.aws.json`.|
| Secret | Description |
| :---------------------- | ---------------------------------------------------- |
| `AWS_ACCESS_KEY_ID` | AWS IAM access key ID used to deploy. |
| `AWS_SECRET_ACCESS_KEY` | AWS IAM access secret used to deploy. |
| `AWS_DEFAULT_REGION` | AWS region to use. |
| `ECR_REPO` | ECR Repository which stores the docker images. |
| `BUCKET_NAME` | S3 Bucket used to store zipped `Dockerrun.aws.json`. |

There are also environment secrets for each environment (`staging`, `staging-alt`, `release`, `uat`):
| Secret | Description|
|:---------|------------|
|`APP_NAME`|Application name for the environment.|
|`DEPLOY_ENV`|Deployment environment on elastic beanstalk.|
|`REACT_APP_FORMSG_SDK_MODE`|Determines the keys used in the formsg SDK. Set either `production` or `staging`.|
| Secret | Description |
| :-------------------------- | --------------------------------------------------------------------------------- |
| `APP_NAME` | Application name for the environment. |
| `DEPLOY_ENV` | Deployment environment on elastic beanstalk. |
| `REACT_APP_FORMSG_SDK_MODE` | Determines the keys used in the formsg SDK. Set either `production` or `staging`. |

## Environment Variables

Expand Down Expand Up @@ -244,14 +244,14 @@ SITE_BANNER_CONTENT=hello:This is an invalid banner type, and the full text will
#### Rate limits at specific endpoints

The app applies per-minute, per-IP rate limits at specific API endpoints as a security measure. The limits can be specified with the following environment variables.
| Variable | Description |
| :-------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SUBMISSIONS_RATE_LIMIT` | Per-minute, per-IP request limit for each submissions endpoint. The limit is applied separately for the email mode and encrypt mode endpoints. |
| Variable | Description |
| :------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `SUBMISSIONS_RATE_LIMIT` | Per-minute, per-IP request limit for each submissions endpoint. The limit is applied separately for the email mode and encrypt mode endpoints. |
| `SEND_AUTH_OTP_RATE_LIMIT` | Per-minute, per-IP request limit for the endpoint which requests for new login OTPs for the admin console or mobile / email field verifications. |

### Additional Features

The app contains a number of additional features like Captcha protection, Sentry reporting and Google Analytics. Each of these features requires specific environment variables which are detailed below.
The app contains a number of additional features like Captcha protection. Each of these features requires specific environment variables which are detailed below.

#### Google Captcha

Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-frontend",
"version": "6.132.0",
"version": "6.133.0",
"homepage": ".",
"private": true,
"dependencies": {
Expand Down
29 changes: 16 additions & 13 deletions frontend/src/app/AdminNavBar/AdminNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
useDisclosure,
} from '@chakra-ui/react'

import { SeenFlags } from '~shared/types'

import { BxsHelpCircle } from '~assets/icons/BxsHelpCircle'
import { BxsRocket } from '~assets/icons/BxsRocket'
import { ReactComponent as BrandMarkSvg } from '~assets/svgs/brand/brand-mark-colour.svg'
Expand All @@ -31,12 +33,12 @@ import IconButton from '~components/IconButton'
import Link from '~components/Link'
import { AvatarMenu, AvatarMenuDivider } from '~templates/AvatarMenu/AvatarMenu'

import { SeenFlagsMapVersion } from '~features/user/constants'
import { EmergencyContactModal } from '~features/user/emergency-contact/EmergencyContactModal'
import { useUserMutations } from '~features/user/mutations'
import { useUser } from '~features/user/queries'
import { TransferOwnershipModal } from '~features/user/transfer-ownership/TransferOwnershipModal'
import { FEATURE_UPDATE_LIST } from '~features/whats-new/FeatureUpdateList'
import { getShowLatestFeatureUpdateNotification } from '~features/whats-new/utils/utils'
import { getShowFeatureFlagLastSeen } from '~features/user/utils'
import { WhatsNewDrawer } from '~features/whats-new/WhatsNewDrawer'

import Menu from '../../components/Menu'
Expand Down Expand Up @@ -156,7 +158,7 @@ export interface AdminNavBarProps {

export const AdminNavBar = ({ isMenuOpen }: AdminNavBarProps): JSX.Element => {
const { user, isLoading: isUserLoading, removeQuery } = useUser()
const { updateLastSeenFeatureVersionMutation } = useUserMutations()
const { updateLastSeenFlagMutation } = useUserMutations()

const whatsNewFeatureDrawerDisclosure = useDisclosure()

Expand Down Expand Up @@ -199,26 +201,27 @@ export const AdminNavBar = ({ isMenuOpen }: AdminNavBarProps): JSX.Element => {

const shouldShowFeatureUpdateNotification = useMemo(() => {
if (isUserLoading || !user) return false
return getShowLatestFeatureUpdateNotification(user)
return getShowFeatureFlagLastSeen(
user,
SeenFlags.LastSeenFeatureUpdateVersion,
)
}, [isUserLoading, user])

const onWhatsNewDrawerOpen = useCallback(() => {
if (isUserLoading || !user) return
// Update version if current user version is not set or is less than the latest version.
if (
user.flags?.lastSeenFeatureUpdateVersion === undefined ||
user.flags?.lastSeenFeatureUpdateVersion < FEATURE_UPDATE_LIST.version
) {
updateLastSeenFeatureVersionMutation.mutateAsync(
FEATURE_UPDATE_LIST.version,
)
if (shouldShowFeatureUpdateNotification) {
updateLastSeenFlagMutation.mutateAsync({
version: SeenFlagsMapVersion.lastSeenFeatureUpdateVersion,
flag: SeenFlags.LastSeenFeatureUpdateVersion,
})
}
whatsNewFeatureDrawerDisclosure.onOpen()
}, [
isUserLoading,
updateLastSeenFeatureVersionMutation,
updateLastSeenFlagMutation,
user,
whatsNewFeatureDrawerDisclosure,
shouldShowFeatureUpdateNotification,
])

// Emergency contact modal appears after the rollout announcement modal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
BiShow,
BiUserPlus,
} from 'react-icons/bi'
import { GoPrimitiveDot } from 'react-icons/go'
import { Link as ReactLink, useLocation } from 'react-router-dom'
import {
Box,
Expand All @@ -18,14 +19,16 @@ import {
Flex,
Grid,
GridItem,
Icon,
Skeleton,
Text,
useBreakpointValue,
useDisclosure,
} from '@chakra-ui/react'
import format from 'date-fns/format'

import { AdminFormDto } from '~shared/types/form/form'
import { SeenFlags } from '~shared/types'
import { AdminFormDto, FormResponseMode } from '~shared/types/form/form'

import {
ACTIVE_ADMINFORM_BUILDER_ROUTE_REGEX,
Expand All @@ -40,14 +43,19 @@ import IconButton from '~components/IconButton'
import Tooltip from '~components/Tooltip'
import { NavigationTab, NavigationTabList } from '~templates/NavigationTabs'

import { SeenFlagsMapVersion } from '~features/user/constants'
import { useUserMutations } from '~features/user/mutations'
import { useUser } from '~features/user/queries'
import { getShowFeatureFlagLastSeen } from '~features/user/utils'

import { AdminFormNavbarBreadcrumbs } from './AdminFormNavbarBreadcrumbs'

export interface AdminFormNavbarProps {
/**
* Minimum form info needed to render the navbar.
* If not provided, the navbar will be in a loading state.
*/
formInfo?: Pick<AdminFormDto, 'title' | 'lastModified'>
formInfo?: AdminFormDto
viewOnly: boolean
handleAddCollabButtonClick: () => void
handleShareButtonClick: () => void
Expand All @@ -68,6 +76,15 @@ export const AdminFormNavbar = ({
const { isOpen, onClose, onOpen } = useDisclosure()
const { pathname } = useLocation()

const { user, isLoading: isUserLoading } = useUser()
const { updateLastSeenFlagMutation } = useUserMutations()
const shouldShowSettingsReddot = useMemo(() => {
const isMrf = formInfo?.responseMode === FormResponseMode.Multirespondent

if (isUserLoading || !user || isMrf) return false
return getShowFeatureFlagLastSeen(user, SeenFlags.SettingsNotification)
}, [isUserLoading, user, formInfo?.responseMode])

const tabResponsiveVariant = useBreakpointValue({
base: 'line-dark',
xs: 'line-dark',
Expand Down Expand Up @@ -171,8 +188,25 @@ export const AdminFormNavbar = ({
hidden={viewOnly}
to={ADMINFORM_SETTINGS_SUBROUTE}
isActive={checkTabActive(ADMINFORM_SETTINGS_SUBROUTE)}
onClick={() => {
if (shouldShowSettingsReddot) {
updateLastSeenFlagMutation.mutate({
flag: SeenFlags.SettingsNotification,
version: SeenFlagsMapVersion[SeenFlags.SettingsNotification],
})
}
}}
>
Settings
{shouldShowSettingsReddot ? (
<Icon
as={GoPrimitiveDot}
color="danger.500"
position="absolute"
right="-8px"
top="2px"
/>
) : null}
</NavigationTab>
<NavigationTab
to={ADMINFORM_RESULTS_SUBROUTE}
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/features/admin-form/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { FormResponseMode } from '~shared/types'

export const RESPONSE_MODE_TO_TEXT: { [key in FormResponseMode]: string } = {
[FormResponseMode.Multirespondent]: 'Multi-respondent form',
[FormResponseMode.Email]: 'Email mode',
[FormResponseMode.Encrypt]: 'Storage mode',
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,9 @@ export const EditEmail = ({ field }: EditEmailProps): JSX.Element => {

const { data: form } = useCreateTabForm()
const isPdfResponseEnabled = useMemo(
() => form?.responseMode !== FormResponseMode.Encrypt,
() => form?.responseMode !== FormResponseMode.Multirespondent,
[form],
)
const pdfResponseToggleDescription = useMemo(() => {
if (!isPdfResponseEnabled) {
return 'For security reasons, PDF responses are not included in email confirmations for Storage mode forms'
}
}, [isPdfResponseEnabled])

// email confirmation is not supported on MRF
const isToggleEmailConfirmationDisabled = useMemo(
Expand Down Expand Up @@ -239,7 +234,6 @@ export const EditEmail = ({ field }: EditEmailProps): JSX.Element => {
<Toggle
{...register('autoReplyOptions.includeFormSummary')}
label="Include PDF response"
description={pdfResponseToggleDescription}
isDisabled={!isPdfResponseEnabled}
/>
</FormControl>
Expand Down
Loading

0 comments on commit c44a8cc

Please sign in to comment.