From 27f91a2b90ee3145ab97852adda78d0a919a46bb Mon Sep 17 00:00:00 2001 From: darth-coder00 <86726556+darth-coder00@users.noreply.github.com> Date: Sun, 19 Sep 2021 23:54:24 +0530 Subject: [PATCH] Extended release version cookie expiry till a month (#526) --- .../components/Modals/WhatsNewModal/WhatsNewModal.util.ts | 3 +++ .../ui/src/components/Modals/WhatsNewModal/index.tsx | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 catalog-rest-service/src/main/resources/ui/src/components/Modals/WhatsNewModal/WhatsNewModal.util.ts diff --git a/catalog-rest-service/src/main/resources/ui/src/components/Modals/WhatsNewModal/WhatsNewModal.util.ts b/catalog-rest-service/src/main/resources/ui/src/components/Modals/WhatsNewModal/WhatsNewModal.util.ts new file mode 100644 index 00000000000..f07dc390bab --- /dev/null +++ b/catalog-rest-service/src/main/resources/ui/src/components/Modals/WhatsNewModal/WhatsNewModal.util.ts @@ -0,0 +1,3 @@ +export const getReleaseVersionExpiry = () => { + return new Date(Date.now() + 60 * 60 * 24 * 31 * 1000); +}; diff --git a/catalog-rest-service/src/main/resources/ui/src/components/Modals/WhatsNewModal/index.tsx b/catalog-rest-service/src/main/resources/ui/src/components/Modals/WhatsNewModal/index.tsx index d648d20e3dd..c5d2be6dbce 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/Modals/WhatsNewModal/index.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/Modals/WhatsNewModal/index.tsx @@ -21,6 +21,7 @@ import React, { FunctionComponent, useState } from 'react'; import ChangeLogs from './ChangeLogs'; import FeaturesCarousel from './FeaturesCarousel'; import { COOKIE_VERSION, LATEST_VERSION_ID, WHATS_NEW } from './whatsNewData'; +import { getReleaseVersionExpiry } from './WhatsNewModal.util'; // import { Button } from '../../buttons/Button/Button'; type Props = { @@ -56,7 +57,9 @@ export const WhatsNewModal: FunctionComponent = ({ }; const handleCancel = () => { - cookieStorage.setItem(COOKIE_VERSION, 'true'); + cookieStorage.setItem(COOKIE_VERSION, 'true', { + expires: getReleaseVersionExpiry(), + }); onCancel(); };