From 4e5f9807409b7d7d69d1704a7d22cdcba2452824 Mon Sep 17 00:00:00 2001
From: andrej romanov <50377758+auumgn@users.noreply.github.com>
Date: Wed, 30 Oct 2024 15:28:55 +0200
Subject: [PATCH] add verification date cutoff
---
.../modal-email/modal-email.component.html | 12 ++++++++++--
.../side-bar/side-bar/side-bar.component.html | 12 ++++++++++--
src/app/constants.ts | 2 ++
.../verification-date-cutoff.pipe.spec.ts | 8 ++++++++
.../verification-date-cutoff.pipe.ts | 17 +++++++++++++++++
src/app/shared/shared.module.ts | 3 +++
6 files changed, 50 insertions(+), 4 deletions(-)
create mode 100644 src/app/shared/pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe.spec.ts
create mode 100644 src/app/shared/pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe.ts
diff --git a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html
index 8e10b020d4..025cd43935 100644
--- a/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html
+++ b/src/app/cdk/side-bar/modals/modal-email/modal-email.component.html
@@ -134,7 +134,11 @@
: email.sourceName || email.source
"
[isEmailOrDomain]="true"
- [date]="email.verificationDate | monthDayYearDateToString"
+ [date]="
+ email.verificationDate
+ | monthDayYearDateToString
+ | verificationDateCutoff
+ "
[isLastItem]="true"
>
@@ -312,7 +316,11 @@
class="orc-font-small-print"
[name]="orcidEmailValidation"
[isEmailOrDomain]="true"
- [date]="domain.createdDate | monthDayYearDateToString"
+ [date]="
+ domain.createdDate
+ | monthDayYearDateToString
+ | verificationDateCutoff
+ "
[isLastItem]="true"
>
diff --git a/src/app/cdk/side-bar/side-bar/side-bar.component.html b/src/app/cdk/side-bar/side-bar/side-bar.component.html
index ec95bbbffd..c8d875f19c 100644
--- a/src/app/cdk/side-bar/side-bar/side-bar.component.html
+++ b/src/app/cdk/side-bar/side-bar/side-bar.component.html
@@ -147,7 +147,11 @@
: email.sourceName || email.source
"
[isEmailOrDomain]="true"
- [date]="email.verificationDate | monthDayYearDateToString"
+ [date]="
+ email.verificationDate
+ | monthDayYearDateToString
+ | verificationDateCutoff
+ "
[isLastItem]="true"
>
@@ -187,7 +191,11 @@
*ngIf="emailsOpenState"
[name]="orcidEmailValidation"
[isEmailOrDomain]="true"
- [date]="domain.createdDate | monthDayYearDateToString"
+ [date]="
+ domain.createdDate
+ | monthDayYearDateToString
+ | verificationDateCutoff
+ "
[isLastItem]="true"
>
diff --git a/src/app/constants.ts b/src/app/constants.ts
index ac796d58f2..15522e070e 100644
--- a/src/app/constants.ts
+++ b/src/app/constants.ts
@@ -80,6 +80,8 @@ export const ITEM_ACTION_SELECT = 'select'
export const ITEM_ACTION_EXPAND = 'expand'
export const ITEM_ACTION_COLLAPSE = 'collapse'
+export const VERIFICATION_DATE_CUTOFF = new Date('2024-10-28')
+
export const ApplicationRoutes = {
myOrcid: 'my-orcid',
twoFactor: '2fa-signin',
diff --git a/src/app/shared/pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe.spec.ts b/src/app/shared/pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe.spec.ts
new file mode 100644
index 0000000000..b078ffc3dd
--- /dev/null
+++ b/src/app/shared/pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe.spec.ts
@@ -0,0 +1,8 @@
+import { VerificationDateCutoffPipe } from './verification-date-cutoff.pipe'
+
+describe('VerificationDateCutoffPipe', () => {
+ it('create an instance', () => {
+ const pipe = new VerificationDateCutoffPipe()
+ expect(pipe).toBeTruthy()
+ })
+})
diff --git a/src/app/shared/pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe.ts b/src/app/shared/pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe.ts
new file mode 100644
index 0000000000..10fb407471
--- /dev/null
+++ b/src/app/shared/pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe.ts
@@ -0,0 +1,17 @@
+import { Pipe, PipeTransform } from '@angular/core'
+import { VERIFICATION_DATE_CUTOFF } from 'src/app/constants'
+
+@Pipe({
+ name: 'verificationDateCutoff',
+})
+export class VerificationDateCutoffPipe implements PipeTransform {
+ transform(value: string): string | null {
+ if (typeof value === 'string') {
+ const date = new Date(value)
+ if (date >= VERIFICATION_DATE_CUTOFF) {
+ return value
+ }
+ }
+ return null
+ }
+}
diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts
index a2fffd9571..5807f3340b 100644
--- a/src/app/shared/shared.module.ts
+++ b/src/app/shared/shared.module.ts
@@ -50,6 +50,7 @@ import { AffiliationLabelPipe } from './pipes/affiliation-label.pipe'
import { AffiliationTypePipe } from './pipes/affiliation-type/affiliation-type.pipe'
import { ScopePathTypePipe } from './pipes/scope-path-type/scope-path-type.pipe'
import { AppPanelsSortByAriaLabelPipe } from './pipes/app-panels-sort-by-aria-label/app-panels-sort-by-aria-label.pipe'
+import { VerificationDateCutoffPipe } from './pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe'
@NgModule({
imports: [
CommonModule,
@@ -60,6 +61,7 @@ import { AppPanelsSortByAriaLabelPipe } from './pipes/app-panels-sort-by-aria-la
],
declarations: [
MonthDayYearDateToStringPipe,
+ VerificationDateCutoffPipe,
OfflineMessageComponent,
CopyOnClickDirective,
CopyOnClickComponent,
@@ -107,6 +109,7 @@ import { AppPanelsSortByAriaLabelPipe } from './pipes/app-panels-sort-by-aria-la
MatProgressSpinner,
MatExpansionModule,
MonthDayYearDateToStringPipe,
+ VerificationDateCutoffPipe,
OfflineMessageComponent,
MatPaginatorModule,
CopyOnClickDirective,