Skip to content

Commit 81177e6

Browse files
authored
ENG-9951 | User page should display a link to the merger profile page as a redirect (#838)
* feat(user-page): User page should display a link to the merger profile page as a redirect * feat(user-page): Fix banner styling
1 parent 063a1f2 commit 81177e6

File tree

8 files changed

+28
-3
lines changed

8 files changed

+28
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="py-5 px-3 md:p-5 xl:p-4 xl:mt-6">
1+
<div class="py-5 px-3 md:p-5 xl:p-4">
22
<div class="flex align-items-center">
33
<h1>{{ currentUser()?.fullName }}</h1>
44

src/app/features/profile/profile.component.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@
22
<osf-loading-spinner />
33
} @else {
44
@if (user()) {
5-
<osf-profile-information [currentUser]="user()" [showEdit]="isMyProfile()" (editProfile)="toProfileSettings()" />
5+
<div class="mt-7 px-3 md:px-5 xl:px-4">
6+
@if (user()?.mergedBy) {
7+
<p-message class="overview-message w-full mb-4" severity="info">
8+
<ng-template #container>
9+
<span>
10+
{{ 'profile.mergedAccount.message' | translate }}
11+
<a [href]="user()?.mergedBy">{{ user()?.mergedBy }}</a>
12+
</span>
13+
</ng-template>
14+
</p-message>
15+
}
16+
<osf-profile-information [currentUser]="user()" [showEdit]="isMyProfile()" (editProfile)="toProfileSettings()" />
17+
</div>
618

719
@if (defaultSearchFiltersInitialized()) {
820
<div class="mt-6">

src/app/features/profile/profile.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { createDispatchMap, select } from '@ngxs/store';
22

3+
import { TranslatePipe } from '@ngx-translate/core';
4+
5+
import { Message } from 'primeng/message';
6+
37
import {
48
ChangeDetectionStrategy,
59
Component,
@@ -30,7 +34,7 @@ import { FetchUserProfile, ProfileSelectors, SetUserProfile } from './store';
3034
templateUrl: './profile.component.html',
3135
styleUrl: './profile.component.scss',
3236
changeDetection: ChangeDetectionStrategy.OnPush,
33-
imports: [ProfileInformationComponent, GlobalSearchComponent, LoadingSpinnerComponent],
37+
imports: [ProfileInformationComponent, GlobalSearchComponent, LoadingSpinnerComponent, Message, TranslatePipe],
3438
})
3539
export class ProfileComponent implements OnInit, OnDestroy {
3640
private router = inject(Router);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class UserMapper {
3636
canViewReviews: user.attributes.can_view_reviews === true, // [NS] Do not simplify it
3737
timezone: user.attributes.timezone,
3838
locale: user.attributes.locale,
39+
mergedBy: user.links.merged_by,
3940
};
4041
}
4142

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ interface UserLinksJsonApi {
7070
iri: string;
7171
profile_image: string;
7272
self: string;
73+
merged_by?: string;
7374
}
7475

7576
interface UserRelationshipsJsonApi {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ export interface UserModel {
2727
defaultRegionId: string;
2828
link?: string;
2929
iri?: string;
30+
mergedBy?: string;
3031
}

src/assets/i18n/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@
227227
"institutions": "Institutions",
228228
"recentActivity": "Recent Activity"
229229
},
230+
"profile": {
231+
"mergedAccount": {
232+
"message": "This account has been merged with "
233+
}
234+
},
230235
"toast": {
231236
"tos-consent": {
232237
"message": "Notice: We've updated our",

src/testing/mocks/data.mock.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export const MOCK_USER: UserModel = {
5757
defaultRegionId: 'us',
5858
allowIndexing: true,
5959
canViewReviews: true,
60+
mergedBy: undefined,
6061
};
6162

6263
export const MOCK_USER_RELATED_COUNTS: UserRelatedCounts = {

0 commit comments

Comments
 (0)