Skip to content

Commit

Permalink
Link to the email domains page (#2328)
Browse files Browse the repository at this point in the history
* Link to the email domains page

* Check the email domain list as well

* fix testign

---------

Co-authored-by: Leonardo Mendoza Fernadez <[email protected]>
  • Loading branch information
amontenegro and leomendoza123 authored Aug 22, 2024
1 parent b41b1fe commit 0697bef
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ <h2 class="orc-font-body-large" i18n="@@side-bar.emailAddressesUppercase">
address.</ng-container
>
<a
href=""
href="https://support.orcid.org/hc/en-us/articles/25578292888215-Email-Domains"
target="_blank"
rel="noopener noreferrer"
i18n="@@side-bar.findOutMoreAboutVerifiedEmailDomains"
Expand Down
25 changes: 15 additions & 10 deletions src/app/cdk/side-bar/side-bar/side-bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
panelId="emails-panel"
expandButtonsPosition="right"
[isPublicRecord]="isPublicRecord"
[elements]="userRecord.emails.emails"
[elements]="userRecord?.emails?.emails"
[editModalComponent]="modalEmailComponent"
[customControls]="isPublicRecord && emailDomainsTogglz && !loadingTogglz"
[email]="true"
Expand All @@ -44,8 +44,10 @@
id="emails-panel"
[(openState)]="emailsOpenState"
*ngIf="
userRecord?.emails?.emails &&
(!isPublicRecord || userRecord.emails.emails.length > 0)
(!isPublicRecord ||
(userRecord?.emails?.emails && userRecord?.emails?.emails?.length > 0) ||
(userRecord?.emails?.emailDomains && userRecord?.emails?.emailDomains?.length > 0)
)
"
[userRecord]="userRecord"
>
Expand All @@ -61,13 +63,13 @@
</h3>
<app-panel-data
*ngIf="
userRecord.emails.emails.length > 0 &&
userRecord?.emails?.emails?.length > 0 &&
!emailDomainsTogglz &&
!loadingTogglz
"
>
<app-panel-element
*ngFor="let email of userRecord.emails.emails; let last = last"
*ngFor="let email of userRecord?.emails?.emails; let last = last"
[visibility]="
isPublicRecord ? '' : email.verified ? email.visibility : 'PRIVATE'
"
Expand All @@ -88,7 +90,10 @@
</h3>
<app-panel-data
*ngIf="
userRecord.emails.emails.length > 0 &&
(
(userRecord?.emails?.emails && userRecord?.emails?.emails?.length > 0) ||
(userRecord?.emails?.emailDomains && userRecord?.emails?.emailDomains?.length > 0)
) &&
isPublicRecord &&
emailDomainsTogglz &&
!loadingTogglz
Expand Down Expand Up @@ -131,23 +136,23 @@
</h3>
<app-panel-data
*ngIf="
userRecord.emails.emails.length > 0 &&
userRecord?.emails?.emails?.length > 0 &&
!isPublicRecord &&
emailDomainsTogglz &&
!loadingTogglz
"
>
<h4 header i18n="@@side-bar.emailAddresses">Email addresses</h4>
<app-panel-element
*ngFor="let email of userRecord.emails.emails; let last = last"
*ngFor="let email of userRecord?.emails?.emails; let last = last"
[visibility]="email.verified ? email.visibility : 'PRIVATE'"
[separator]="!last"
>{{ email.value }}
</app-panel-element>
</app-panel-data>
<app-panel-data
*ngIf="
userRecord.emails?.emailDomains?.length > 0 &&
userRecord?.emails?.emailDomains?.length > 0 &&
!isPublicRecord &&
emailDomainsTogglz &&
!loadingTogglz
Expand All @@ -158,7 +163,7 @@ <h4 header i18n="@@side-bar.verifiedEmailDomains">
</h4>
<app-panel-element
*ngFor="
let emailDomain of userRecord.emails.emailDomains;
let emailDomain of userRecord?.emails.emailDomains;
let last = last
"
[visibility]="isPublicRecord ? '' : emailDomain.visibility"
Expand Down
7 changes: 2 additions & 5 deletions src/app/cdk/side-bar/side-bar/side-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,14 @@ export class SideBarComponent implements OnInit, OnDestroy {
this.publicEmailList.length === 0 &&
this.publicDomainList.length === 0
) {
const domainsToExclude: AssertionVisibilityString[] = []
this.userRecord.emails?.emails.forEach((email) => {
this.userRecord.emails?.emails?.forEach((email) => {
const professionalDomain = this.userRecord.emails.emailDomains?.find(
(emailDomain) => email.value.split('@')[1] === emailDomain.value
)

if (professionalDomain) {
if (email.visibility === 'PUBLIC') {
this.publicEmailList.push(email)
domainsToExclude.push(professionalDomain)
} else if (
professionalDomain.visibility === 'PUBLIC' &&
!this.publicDomainList.includes(professionalDomain)
Expand All @@ -176,8 +174,7 @@ export class SideBarComponent implements OnInit, OnDestroy {
})
this.userRecord.emails?.emailDomains?.forEach((emailDomain) => {
if (
emailDomain.visibility === 'PUBLIC' &&
!domainsToExclude.includes(emailDomain)
emailDomain.visibility === 'PUBLIC'
) {
this.publicDomainList.push(emailDomain)
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/utils/record.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export class RecordUtil {
if (
(userRecord?.emails?.emails &&
(!isPublicRecord || userRecord.emails.emails.length > 0)) ||
(userRecord?.emails?.emailDomains &&
(!isPublicRecord || userRecord.emails.emailDomains.length > 0)) ||
(userRecord?.website?.websites &&
(!isPublicRecord || userRecord.website.websites.length > 0)) ||
(userRecord?.externalIdentifier?.externalIdentifiers &&
Expand Down
Binary file not shown.

0 comments on commit 0697bef

Please sign in to comment.