Skip to content

Commit f67d207

Browse files
authored
Merge pull request #849 from bodintsov/fix/fix-authenticated-ORCID-is-not-displayed
[ENG-9975] Fix(profile-information): fix orcid displayed on user profile
2 parents 20196f5 + 5fae88b commit f67d207

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

src/app/features/profile/components/profile-information/profile-information.component.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ <h1>{{ currentUser()?.fullName }}</h1>
1414

1515
<div class="flex flex-column gap-4 min-w-0 xl:align-items-end xl:flex-1">
1616
<div class="flex flex-column gap-3 w-full md:flex-row xl:gap-4 xl:justify-content-end">
17-
@if (currentUser()?.social?.orcid) {
17+
@if (orcidId()) {
1818
<div class="flex flex-row align-items-center gap-2">
1919
<img ngSrc="assets/icons/colored/orcid.svg" width="16" height="16" alt="orcid" />
20-
<a class="font-bold" [href]="'https://orcid.org/' + currentUser()?.social?.orcid">
21-
https://orcid.org/{{ currentUser()?.social?.orcid }}
22-
</a>
20+
<a class="font-bold" [href]="'https://orcid.org/' + orcidId()"> https://orcid.org/{{ orcidId() }} </a>
2321
</div>
2422
}
2523

src/app/features/profile/components/profile-information/profile-information.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ export class ProfileInformationComponent {
4343

4444
userSocials = computed(() => mapUserSocials(this.currentUser()?.social, SOCIAL_LINKS));
4545

46+
orcidId = computed(() => {
47+
const orcid = this.currentUser()?.external_identity?.ORCID;
48+
return orcid?.status?.toUpperCase() === 'VERIFIED' ? orcid.id : undefined;
49+
});
50+
4651
toProfileSettings() {
4752
this.editProfile.emit();
4853
}

src/app/shared/mappers/user/user.mapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class UserMapper {
3232
employment: user.attributes.employment,
3333
iri: user.links.iri,
3434
social: user.attributes.social,
35+
external_identity: user.attributes.external_identity,
3536
defaultRegionId: user.relationships?.default_region?.data?.id,
3637
canViewReviews: user.attributes.can_view_reviews === true, // [NS] Do not simplify it
3738
timezone: user.attributes.timezone,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export interface OrcidInfo {
2+
id: string;
3+
status: string;
4+
}
5+
6+
export interface ExternalIdentityModel {
7+
ORCID?: OrcidInfo | null;
8+
}

src/app/shared/models/user/user-json-api.model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ResponseDataJsonApi } from '../common/json-api.model';
22

33
import { Education } from './education.model';
44
import { Employment } from './employment.model';
5+
import { ExternalIdentityModel } from './external-identity.model';
56
import { SocialModel } from './social.model';
67

78
export type UserResponseJsonApi = ResponseDataJsonApi<UserDataJsonApi>;
@@ -47,6 +48,7 @@ export interface UserAttributesJsonApi {
4748
suffix: string;
4849
locale: string;
4950
social: SocialModel;
51+
external_identity: ExternalIdentityModel;
5052
timezone: string;
5153
}
5254

src/app/shared/models/user/user.models.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Education } from './education.model';
22
import { Employment } from './employment.model';
3+
import { ExternalIdentityModel } from './external-identity.model';
34
import { SocialModel } from './social.model';
45

56
export interface UserData {
@@ -24,6 +25,7 @@ export interface UserModel {
2425
timezone: string;
2526
locale: string;
2627
social: SocialModel;
28+
external_identity: ExternalIdentityModel;
2729
defaultRegionId: string;
2830
link?: string;
2931
iri?: string;

0 commit comments

Comments
 (0)