From 12ee3f1c987ef052ac4ff85867be6f6937415167 Mon Sep 17 00:00:00 2001 From: Leonardo Mendoza Fernadez Date: Fri, 29 Nov 2024 08:22:39 -0600 Subject: [PATCH] qa-localstorage-check-should-be-background-compatible-with-the-previous-release --- .../cdk/interstitials/interstitials.service.ts | 18 +++++++++++++++--- .../share-emails-domains.component.ts | 6 +++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/app/cdk/interstitials/interstitials.service.ts b/src/app/cdk/interstitials/interstitials.service.ts index 29e24af39..341a69251 100644 --- a/src/app/cdk/interstitials/interstitials.service.ts +++ b/src/app/cdk/interstitials/interstitials.service.ts @@ -22,9 +22,21 @@ export class InterstitialsService { return this._userInfo.getUserSession().pipe( map((userInfo) => { const effectiveUser = userInfo.userInfo.EFFECTIVE_USER_ORCID - return ( - localStorage.getItem(effectiveUser + '_' + interstitial) === 'true' - ) + if (interstitial === 'DOMAIN_INTERSTITIAL') { + // This is a weird condition as we changed the localstorage value from OAUTH_DOMAIN_INTERSTITIAL to DOMAIN_INTERSTITIAL + // This is a fix so DOMAIN_INTERSTITIAL is backwards compatible with OAUTH_DOMAIN_INTERSTITIAL + return ( + localStorage.getItem(effectiveUser + '_DOMAIN_INTERSTITIAL') === + 'true' || + localStorage.getItem( + effectiveUser + '_OAUTH_DOMAIN_INTERSTITIAL' + ) === 'true' + ) + } else { + return ( + localStorage.getItem(effectiveUser + '_' + interstitial) === 'true' + ) + } }) ) } diff --git a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts b/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts index 7910bdc42..8b502d829 100644 --- a/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts +++ b/src/app/cdk/interstitials/share-emails-domains/share-emails-domains.component.ts @@ -58,7 +58,11 @@ export class ShareEmailsDomainsComponent { return value?.emailDomains .filter((domain) => domain.visibility !== 'PUBLIC') .sort((a, b) => { - return b.createdDate.timestamp - a.createdDate.timestamp + if (b?.createdDate?.timestamp && a?.createdDate?.timestamp) { + return b.createdDate.timestamp - a.createdDate.timestamp + } else { + return 0 + } }) .slice(0, 3) }