Skip to content

Commit 9b52cdd

Browse files
authored
fix(contributors): updated contributors table for deactivated user (#518)
1 parent 841669f commit 9b52cdd

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/app/shared/components/contributors-list/contributors-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
} @else {
55
@for (contributor of contributors(); track contributor.id) {
66
<div>
7-
@if (readonly() || contributor.isUnregisteredContributor || !contributor.userId) {
7+
@if (readonly() || contributor.isUnregisteredContributor || contributor.deactivated) {
88
<span data-test-contributor-name>{{ contributor.fullName }}{{ $last ? '' : ',' }}</span>
99
} @else {
1010
<a class="font-bold" [routerLink]="['/user', contributor.userId]" data-test-contributor-name>

src/app/shared/components/contributors/contributors-table/contributors-table.component.html

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ <h2>{{ 'project.contributors.curatorInfo.heading' | translate }}</h2>
102102
</p>
103103
</td>
104104
<td>
105-
@if (isCurrentUserAdminContributor()) {
105+
@if (isCurrentUserAdminContributor() && !contributor.deactivated) {
106106
<div class="w-9rem">
107107
<osf-select
108108
[options]="permissionsOptions"
@@ -134,7 +134,7 @@ <h2>{{ 'project.contributors.curatorInfo.heading' | translate }}</h2>
134134
binary="true"
135135
[(ngModel)]="contributor.isBibliographic"
136136
[ariaLabel]="'project.contributors.table.headers.contributor' | translate"
137-
[readonly]="!isCurrentUserAdminContributor()"
137+
[disabled]="!isCurrentUserAdminContributor() || contributor.deactivated"
138138
></p-checkbox>
139139
</div>
140140
</td>
@@ -154,14 +154,13 @@ <h2>{{ 'project.contributors.curatorInfo.heading' | translate }}</h2>
154154
@if (showEmployment()) {
155155
<td>
156156
@if (contributor.employment?.length) {
157-
<a
158-
class="font-bold cursor-pointer"
159-
tabindex="0"
160-
(click)="openEmploymentHistory(contributor)"
157+
<p-button
158+
link
159+
class="link-btn-no-padding"
160+
[label]="'project.contributors.employment.show' | translate"
161+
(onClick)="openEmploymentHistory(contributor)"
161162
(keydown.enter)="openEmploymentHistory(contributor)"
162-
>
163-
{{ 'project.contributors.employment.show' | translate }}
164-
</a>
163+
/>
165164
} @else {
166165
<span>{{ 'project.contributors.employment.none' | translate }}</span>
167166
}
@@ -171,14 +170,13 @@ <h2>{{ 'project.contributors.curatorInfo.heading' | translate }}</h2>
171170
<td>
172171
<div class="flex column-gap-2">
173172
@if (contributor.education?.length) {
174-
<a
175-
class="font-bold cursor-pointer"
176-
tabindex="0"
177-
(click)="openEducationHistory(contributor)"
173+
<p-button
174+
link
175+
class="link-btn-no-padding"
176+
[label]="'project.contributors.education.show' | translate"
177+
(onClick)="openEducationHistory(contributor)"
178178
(keydown.enter)="openEducationHistory(contributor)"
179-
>
180-
{{ 'project.contributors.education.show' | translate }}
181-
</a>
179+
/>
182180
} @else {
183181
<span>{{ 'project.contributors.education.none' | translate }}</span>
184182
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ export class ContributorsMapper {
3232
isCurator: response.attributes.is_curator,
3333
permission: response.attributes.permission,
3434
index: response.attributes.index,
35-
userId: errorMeta ? '' : userData?.id || '',
35+
userId: errorMeta ? response?.id?.split('-')[1] : userData?.id || '',
3636
fullName: errorMeta ? errorMeta?.full_name : userData?.attributes?.full_name || '',
3737
givenName: errorMeta ? errorMeta?.given_name : userData?.attributes?.given_name || '',
3838
familyName: errorMeta ? errorMeta?.family_name : userData?.attributes?.family_name || '',
3939
education: errorMeta ? [] : userData?.attributes?.education || [],
4040
employment: errorMeta ? [] : userData?.attributes?.employment || [],
41+
deactivated: !!errorMeta,
4142
};
4243
}
4344

src/app/shared/models/contributors/contributor.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface ContributorModel {
1515
familyName: string;
1616
employment: Employment[];
1717
education: Education[];
18+
deactivated: boolean;
1819
}
1920

2021
export type ContributorShortInfoModel = Pick<

0 commit comments

Comments
 (0)