Skip to content

Commit

Permalink
add verification date cutoff (#2383)
Browse files Browse the repository at this point in the history
Co-authored-by: Angel Montenegro <[email protected]>
  • Loading branch information
auumgn and amontenegro authored Oct 30, 2024
1 parent 68e1757 commit a844d6c
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/app/cdk/side-bar/modals/modal-email/modal-email.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ <h2 class="orc-font-body-large" i18n="@@side-bar.emailAddressesUppercase">
: email.sourceName || email.source
"
[isEmailOrDomain]="true"
[date]="email.verificationDate | monthDayYearDateToString"
[date]="
email.verificationDate
| monthDayYearDateToString
| verificationDateCutoff
"
[isLastItem]="true"
>
</app-panel-element-source>
Expand Down Expand Up @@ -312,7 +316,11 @@ <h2 class="orc-font-body-large" i18n="@@side-bar.emailAddressesUppercase">
class="orc-font-small-print"
[name]="orcidEmailValidation"
[isEmailOrDomain]="true"
[date]="domain.createdDate | monthDayYearDateToString"
[date]="
domain.createdDate
| monthDayYearDateToString
| verificationDateCutoff
"
[isLastItem]="true"
>
</app-panel-element-source>
Expand Down
12 changes: 10 additions & 2 deletions src/app/cdk/side-bar/side-bar/side-bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ <h4 header i18n="@@side-bar.verifiedEmailAddresses">
: email.sourceName || email.source
"
[isEmailOrDomain]="true"
[date]="email.verificationDate | monthDayYearDateToString"
[date]="
email.verificationDate
| monthDayYearDateToString
| verificationDateCutoff
"
[isLastItem]="true"
>
</app-panel-element-source>
Expand Down Expand Up @@ -187,7 +191,11 @@ <h4 header i18n="@@side-bar.verifiedEmailDomains">
*ngIf="emailsOpenState"
[name]="orcidEmailValidation"
[isEmailOrDomain]="true"
[date]="domain.createdDate | monthDayYearDateToString"
[date]="
domain.createdDate
| monthDayYearDateToString
| verificationDateCutoff
"
[isLastItem]="true"
>
</app-panel-element-source>
Expand Down
2 changes: 2 additions & 0 deletions src/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { VerificationDateCutoffPipe } from './verification-date-cutoff.pipe'

describe('VerificationDateCutoffPipe', () => {
it('create an instance', () => {
const pipe = new VerificationDateCutoffPipe()
expect(pipe).toBeTruthy()
})
})
Original file line number Diff line number Diff line change
@@ -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
}
}
3 changes: 3 additions & 0 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -60,6 +61,7 @@ import { AppPanelsSortByAriaLabelPipe } from './pipes/app-panels-sort-by-aria-la
],
declarations: [
MonthDayYearDateToStringPipe,
VerificationDateCutoffPipe,
OfflineMessageComponent,
CopyOnClickDirective,
CopyOnClickComponent,
Expand Down Expand Up @@ -107,6 +109,7 @@ import { AppPanelsSortByAriaLabelPipe } from './pipes/app-panels-sort-by-aria-la
MatProgressSpinner,
MatExpansionModule,
MonthDayYearDateToStringPipe,
VerificationDateCutoffPipe,
OfflineMessageComponent,
MatPaginatorModule,
CopyOnClickDirective,
Expand Down

0 comments on commit a844d6c

Please sign in to comment.