From f27c6cd618946f4346b659d17a630c62e019728f Mon Sep 17 00:00:00 2001 From: amontenegro Date: Thu, 28 Jul 2022 10:35:02 -0600 Subject: [PATCH] Use EFFECTIVE_USER_ORCID instead of REAL_USER_ORCID to avoid problems when doing delegation mode --- .../work-contributor-roles.component.spec.ts | 2 +- .../work-contributor-role/work-contributor-roles.component.ts | 2 +- .../work-contributors/work-contributors.component.ts | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/record/components/work-contributor-role/work-contributor-roles.component.spec.ts b/src/app/record/components/work-contributor-role/work-contributor-roles.component.spec.ts index 7ee7e1c1d1..160c724998 100644 --- a/src/app/record/components/work-contributor-role/work-contributor-roles.component.spec.ts +++ b/src/app/record/components/work-contributor-role/work-contributor-roles.component.spec.ts @@ -173,7 +173,7 @@ function getContributor(): Contributor[] { function getUserRecord(): UserRecord { return { userInfo: { - REAL_USER_ORCID: '0000-0000-0000-000X', + EFFECTIVE_USER_ORCID: '0000-0000-0000-000X', }, } as UserRecord } diff --git a/src/app/record/components/work-contributor-role/work-contributor-roles.component.ts b/src/app/record/components/work-contributor-role/work-contributor-roles.component.ts index 0863339fc0..08758c3b5c 100644 --- a/src/app/record/components/work-contributor-role/work-contributor-roles.component.ts +++ b/src/app/record/components/work-contributor-role/work-contributor-roles.component.ts @@ -144,7 +144,7 @@ export class WorkContributorRolesComponent implements OnInit { private getRecordHolderContribution(): Contributor { return this.contributors?.find( (c) => - c?.contributorOrcid?.path === this.userRecord?.userInfo?.REAL_USER_ORCID + c?.contributorOrcid?.path === this.userRecord?.userInfo?.EFFECTIVE_USER_ORCID ) } } diff --git a/src/app/record/components/work-contributors/work-contributors.component.ts b/src/app/record/components/work-contributors/work-contributors.component.ts index 945af557da..39cad3728c 100644 --- a/src/app/record/components/work-contributors/work-contributors.component.ts +++ b/src/app/record/components/work-contributors/work-contributors.component.ts @@ -52,7 +52,9 @@ export class WorkContributorsComponent implements OnInit, OnDestroy { } ngOnInit(): void { - this.id = this.userRecord?.userInfo?.REAL_USER_ORCID + // EFFECTIVE_USER_ORCID keeps the ORCID id of the user you are on. + // REAL_USER_ORCID will contain the orcid id of a delegator when on delegation mode. + this.id = this.userRecord?.userInfo?.EFFECTIVE_USER_ORCID this.platform .get() .pipe(takeUntil(this.$destroy))