Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add verification date cutoff #2383

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading