- @for (contributor of component.contributors; track contributor.id) {
-
diff --git a/src/app/features/project/overview/components/overview-components/overview-components.component.ts b/src/app/features/project/overview/components/overview-components/overview-components.component.ts
index edc6e4ba3..d04e23a9d 100644
--- a/src/app/features/project/overview/components/overview-components/overview-components.component.ts
+++ b/src/app/features/project/overview/components/overview-components/overview-components.component.ts
@@ -9,10 +9,10 @@ import { Skeleton } from 'primeng/skeleton';
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
-import { Router, RouterLink } from '@angular/router';
+import { Router } from '@angular/router';
import { UserSelectors } from '@core/store/user';
-import { IconComponent, TruncatedTextComponent } from '@osf/shared/components';
+import { ContributorsListComponent, IconComponent, TruncatedTextComponent } from '@osf/shared/components';
import { ResourceType, UserPermissions } from '@osf/shared/enums';
import { IS_XSMALL } from '@osf/shared/helpers';
import { ComponentOverview } from '@shared/models';
@@ -23,7 +23,7 @@ import { DeleteComponentDialogComponent } from '../delete-component-dialog/delet
@Component({
selector: 'osf-project-components',
- imports: [Button, Menu, Skeleton, TranslatePipe, TruncatedTextComponent, IconComponent, RouterLink],
+ imports: [Button, Menu, Skeleton, TranslatePipe, TruncatedTextComponent, IconComponent, ContributorsListComponent],
templateUrl: './overview-components.component.html',
styleUrl: './overview-components.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -70,7 +70,7 @@ export class OverviewComponentsComponent {
get isCurrentUserContributor() {
return (component: ComponentOverview) => {
const userId = this.currentUserId();
- return userId ? component.contributors.some((contributor) => contributor.id === userId) : false;
+ return userId ? component.contributors.some((contributor) => contributor.userId === userId) : false;
};
}
diff --git a/src/app/features/project/overview/mappers/project-overview.mapper.ts b/src/app/features/project/overview/mappers/project-overview.mapper.ts
index 7473ac0af..88de48c72 100644
--- a/src/app/features/project/overview/mappers/project-overview.mapper.ts
+++ b/src/app/features/project/overview/mappers/project-overview.mapper.ts
@@ -1,4 +1,4 @@
-import { InstitutionsMapper } from '@shared/mappers';
+import { ContributorsMapper, InstitutionsMapper } from '@shared/mappers';
import { LicenseModel } from '@shared/models';
import { ProjectOverview, ProjectOverviewGetResponseJsonApi } from '../models';
@@ -36,15 +36,7 @@ export class ProjectOverviewMapper {
currentUserIsContributorOrGroupMember: response.attributes.current_user_is_contributor_or_group_member,
wikiEnabled: response.attributes.wiki_enabled,
customCitation: response.attributes.custom_citation,
- contributors:
- response.embeds.bibliographic_contributors?.data?.map((contributor) => ({
- id: contributor.embeds.users.data.id,
- familyName: contributor.embeds.users.data.attributes.family_name,
- fullName: contributor.embeds.users.data.attributes.full_name,
- givenName: contributor.embeds.users.data.attributes.given_name,
- middleName: contributor.embeds.users.data.attributes.middle_name,
- type: contributor.embeds.users.data.type,
- })) ?? [],
+ contributors: ContributorsMapper.getContributors(response?.embeds?.bibliographic_contributors?.data),
affiliatedInstitutions: response.embeds.affiliated_institutions
? InstitutionsMapper.fromInstitutionsResponse(response.embeds.affiliated_institutions)
: [],
diff --git a/src/app/features/project/overview/models/project-overview.models.ts b/src/app/features/project/overview/models/project-overview.models.ts
index 64b632ba1..4390b4020 100644
--- a/src/app/features/project/overview/models/project-overview.models.ts
+++ b/src/app/features/project/overview/models/project-overview.models.ts
@@ -1,5 +1,7 @@
import { UserPermissions } from '@osf/shared/enums';
import {
+ ContributorDataJsonApi,
+ ContributorModel,
Identifier,
IdTypeModel,
Institution,
@@ -10,15 +12,6 @@ import {
MetaAnonymousJsonApi,
} from '@osf/shared/models';
-export interface ProjectOverviewContributor {
- familyName: string;
- fullName: string;
- givenName: string;
- middleName: string;
- id: string;
- type: string;
-}
-
export interface ProjectOverview {
id: string;
type: string;
@@ -52,7 +45,7 @@ export interface ProjectOverview {
currentUserIsContributor: boolean;
currentUserIsContributorOrGroupMember: boolean;
wikiEnabled: boolean;
- contributors: ProjectOverviewContributor[];
+ contributors: ContributorModel[];
customCitation: string | null;
region?: IdTypeModel;
affiliatedInstitutions?: Institution[];
@@ -113,22 +106,7 @@ export interface ProjectOverviewGetResponseJsonApi {
}[];
};
bibliographic_contributors: {
- data: {
- embeds: {
- users: {
- data: {
- id: string;
- type: string;
- attributes: {
- family_name: string;
- full_name: string;
- given_name: string;
- middle_name: string;
- };
- };
- };
- };
- }[];
+ data: ContributorDataJsonApi[];
};
license: {
data: {
diff --git a/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.html b/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.html
index 0e1864b7c..7c626c448 100644
--- a/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.html
+++ b/src/app/features/registries/components/registries-metadata-step/registries-contributors/registries-contributors.component.html
@@ -1,7 +1,7 @@
{{ 'project.overview.metadata.contributors' | translate }}
- {{ 'common.labels.description' | translate }}
diff --git a/src/app/features/registries/components/review/review.component.ts b/src/app/features/registries/components/review/review.component.ts
index 5862e1a80..f2cfb1f41 100644
--- a/src/app/features/registries/components/review/review.component.ts
+++ b/src/app/features/registries/components/review/review.component.ts
@@ -13,10 +13,10 @@ import { map, of } from 'rxjs';
import { ChangeDetectionStrategy, Component, computed, effect, inject } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
-import { ActivatedRoute, Router, RouterLink } from '@angular/router';
+import { ActivatedRoute, Router } from '@angular/router';
import { ENVIRONMENT } from '@core/provider/environment.provider';
-import { RegistrationBlocksDataComponent } from '@osf/shared/components';
+import { ContributorsListComponent, RegistrationBlocksDataComponent } from '@osf/shared/components';
import { INPUT_VALIDATION_MESSAGES } from '@osf/shared/constants';
import { FieldType, ResourceType } from '@osf/shared/enums';
import { InterpolatePipe } from '@osf/shared/pipes';
@@ -45,7 +45,6 @@ import { SelectComponentsDialogComponent } from '../select-components-dialog/sel
TranslatePipe,
Card,
Message,
- RouterLink,
Tag,
Button,
Accordion,
@@ -54,6 +53,7 @@ import { SelectComponentsDialogComponent } from '../select-components-dialog/sel
AccordionPanel,
InterpolatePipe,
RegistrationBlocksDataComponent,
+ ContributorsListComponent,
],
templateUrl: './review.component.html',
styleUrl: './review.component.scss',
diff --git a/src/app/features/registry/components/registration-links-card/registration-links-card.component.html b/src/app/features/registry/components/registration-links-card/registration-links-card.component.html
index bd9d2fed0..6c0d081f4 100644
--- a/src/app/features/registry/components/registration-links-card/registration-links-card.component.html
+++ b/src/app/features/registry/components/registration-links-card/registration-links-card.component.html
@@ -39,15 +39,8 @@
diff --git a/src/app/features/registry/components/registration-links-card/registration-links-card.component.ts b/src/app/features/registry/components/registration-links-card/registration-links-card.component.ts
index 5c597ef20..a5b50c72e 100644
--- a/src/app/features/registry/components/registration-links-card/registration-links-card.component.ts
+++ b/src/app/features/registry/components/registration-links-card/registration-links-card.component.ts
@@ -5,9 +5,13 @@ import { Card } from 'primeng/card';
import { DatePipe } from '@angular/common';
import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';
-import { RouterLink } from '@angular/router';
-import { DataResourcesComponent, IconComponent, TruncatedTextComponent } from '@osf/shared/components';
+import {
+ ContributorsListComponent,
+ DataResourcesComponent,
+ IconComponent,
+ TruncatedTextComponent,
+} from '@osf/shared/components';
import { RevisionReviewStates } from '@osf/shared/enums';
import { LinkedNode, LinkedRegistration, RegistryComponentModel } from '../../models';
@@ -22,7 +26,7 @@ import { LinkedNode, LinkedRegistration, RegistryComponentModel } from '../../mo
DataResourcesComponent,
TruncatedTextComponent,
IconComponent,
- RouterLink,
+ ContributorsListComponent,
],
templateUrl: './registration-links-card.component.html',
styleUrl: './registration-links-card.component.scss',
diff --git a/src/app/features/registry/components/short-registration-info/short-registration-info.component.html b/src/app/features/registry/components/short-registration-info/short-registration-info.component.html
index 066099deb..4487d7184 100644
--- a/src/app/features/registry/components/short-registration-info/short-registration-info.component.html
+++ b/src/app/features/registry/components/short-registration-info/short-registration-info.component.html
@@ -1,33 +1,32 @@
-
{{ 'navigation.contributors' | translate }}
-
- @for (contributor of registration().contributors; track contributor.id) {
-
- {{ contributor.fullName }}
- {{ !$last ? ', ' : '' }}
-
- }
-
+
{{ 'common.labels.contributors' | translate }}
+
+
+
{{ 'common.labels.description' | translate }}
{{ registration().description }}
+
{{ 'registry.overview.metadata.type' | translate }}
{{ registration().registrationType }}
+
{{ 'registry.overview.metadata.registeredDate' | translate }}
{{ registration().dateRegistered | date }}
+
{{ 'registry.archiving.createdDate' | translate }}
{{ registration().dateCreated | date }}
+
{{ 'registry.overview.metadata.associatedProject' | translate }}
{{ associatedProjectUrl }}
diff --git a/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts b/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts
index 3f388056d..b859aec99 100644
--- a/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts
+++ b/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts
@@ -5,12 +5,13 @@ import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core
import { RouterLink } from '@angular/router';
import { ENVIRONMENT } from '@core/provider/environment.provider';
+import { ContributorsListComponent } from '@osf/shared/components';
import { RegistryOverview } from '../../models';
@Component({
selector: 'osf-short-registration-info',
- imports: [TranslatePipe, DatePipe, RouterLink],
+ imports: [TranslatePipe, DatePipe, RouterLink, ContributorsListComponent],
templateUrl: './short-registration-info.component.html',
styleUrl: './short-registration-info.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
diff --git a/src/app/features/registry/mappers/linked-nodes.mapper.ts b/src/app/features/registry/mappers/linked-nodes.mapper.ts
index e6d73c72d..cfc31289e 100644
--- a/src/app/features/registry/mappers/linked-nodes.mapper.ts
+++ b/src/app/features/registry/mappers/linked-nodes.mapper.ts
@@ -15,7 +15,7 @@ export class LinkedNodesMapper {
isPublic: apiNode.attributes.public,
htmlUrl: apiNode.links.html,
apiUrl: apiNode.links.self,
- contributors: ContributorsMapper.fromResponse(apiNode.embeds.bibliographic_contributors.data) || [],
+ contributors: ContributorsMapper.getContributors(apiNode.embeds.bibliographic_contributors.data) || [],
};
}
}
diff --git a/src/app/features/registry/mappers/linked-registrations.mapper.ts b/src/app/features/registry/mappers/linked-registrations.mapper.ts
index fc27a69d1..a7d1f527e 100644
--- a/src/app/features/registry/mappers/linked-registrations.mapper.ts
+++ b/src/app/features/registry/mappers/linked-registrations.mapper.ts
@@ -26,7 +26,7 @@ export class LinkedRegistrationsMapper {
pendingRegistrationApproval: apiRegistration.attributes.pending_registration_approval,
registrationSupplement: apiRegistration.attributes.registration_supplement,
currentUserPermissions: apiRegistration.attributes.current_user_permissions,
- contributors: ContributorsMapper.fromResponse(apiRegistration.embeds.bibliographic_contributors.data) || [],
+ contributors: ContributorsMapper.getContributors(apiRegistration.embeds.bibliographic_contributors.data) || [],
};
}
}
diff --git a/src/app/features/registry/mappers/registry-components.mapper.ts b/src/app/features/registry/mappers/registry-components.mapper.ts
index 6d38e2bb7..af272a2fc 100644
--- a/src/app/features/registry/mappers/registry-components.mapper.ts
+++ b/src/app/features/registry/mappers/registry-components.mapper.ts
@@ -15,7 +15,7 @@ export class RegistryComponentsMapper {
registrationSupplement: apiComponent.attributes.registration_supplement,
tags: apiComponent.attributes.tags,
isPublic: apiComponent.attributes.public,
- contributors: ContributorsMapper.fromResponse(apiComponent.embeds.bibliographic_contributors.data) || [],
+ contributors: ContributorsMapper.getContributors(apiComponent.embeds.bibliographic_contributors.data) || [],
};
}
diff --git a/src/app/features/registry/mappers/registry-overview.mapper.ts b/src/app/features/registry/mappers/registry-overview.mapper.ts
index f6133dc0a..768660c8c 100644
--- a/src/app/features/registry/mappers/registry-overview.mapper.ts
+++ b/src/app/features/registry/mappers/registry-overview.mapper.ts
@@ -1,4 +1,4 @@
-import { IdentifiersMapper, LicensesMapper } from '@osf/shared/mappers';
+import { ContributorsMapper, IdentifiersMapper, LicensesMapper } from '@osf/shared/mappers';
import { MapRegistryStatus, RegistrationMapper, RegistrationNodeMapper } from '@osf/shared/mappers/registration';
import { RegistryOverview, RegistryOverviewJsonApiData } from '../models';
@@ -27,14 +27,7 @@ export function MapRegistryOverview(data: RegistryOverviewJsonApiData): Registry
registrationType: data.attributes?.registration_supplement,
doi: data.attributes?.article_doi,
tags: data.attributes?.tags,
- contributors: data.embeds?.bibliographic_contributors?.data.map((contributor) => ({
- id: contributor?.embeds?.users?.data?.id,
- familyName: contributor?.embeds?.users?.data?.attributes?.family_name,
- fullName: contributor?.embeds?.users?.data?.attributes?.full_name,
- givenName: contributor?.embeds?.users?.data?.attributes?.given_name,
- middleName: contributor?.embeds?.users?.data?.attributes?.middle_names,
- type: contributor?.embeds?.users?.data?.type,
- })),
+ contributors: ContributorsMapper.getContributors(data?.embeds?.bibliographic_contributors?.data),
identifiers: IdentifiersMapper.fromJsonApi(data.embeds?.identifiers),
analyticsKey: data.attributes?.analytics_key,
currentUserCanComment: data.attributes.current_user_can_comment,
diff --git a/src/app/features/registry/models/get-registry-overview-json-api.model.ts b/src/app/features/registry/models/get-registry-overview-json-api.model.ts
index 83d678a18..79bc04867 100644
--- a/src/app/features/registry/models/get-registry-overview-json-api.model.ts
+++ b/src/app/features/registry/models/get-registry-overview-json-api.model.ts
@@ -1,6 +1,7 @@
import { RegistrationReviewStates, RevisionReviewStates } from '@osf/shared/enums';
import {
ApiData,
+ ContributorDataJsonApi,
IdentifiersJsonApiData,
JsonApiResponseWithMeta,
LicenseDataJsonApi,
@@ -73,22 +74,7 @@ export type RegistrationQuestions = Record
+ @if (anonymous()) {
+ {{ 'project.overview.metadata.anonymousContributors' | translate }}
+ } @else {
+ @for (contributor of contributors(); track contributor.id) {
+
+ }
+ }
+
diff --git a/src/app/shared/components/contributors-list/contributors-list.component.scss b/src/app/shared/components/contributors-list/contributors-list.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/app/shared/components/contributors-list/contributors-list.component.spec.ts b/src/app/shared/components/contributors-list/contributors-list.component.spec.ts
new file mode 100644
index 000000000..393521b2e
--- /dev/null
+++ b/src/app/shared/components/contributors-list/contributors-list.component.spec.ts
@@ -0,0 +1,26 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TranslateServiceMock } from '@shared/mocks';
+
+import { ContributorsListComponent } from './contributors-list.component';
+
+describe('ContributorsListComponent', () => {
+ let component: ContributorsListComponent;
+ let fixture: ComponentFixture
;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [ContributorsListComponent],
+ providers: [TranslateServiceMock],
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(ContributorsListComponent);
+ component = fixture.componentInstance;
+
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/shared/components/contributors-list/contributors-list.component.ts b/src/app/shared/components/contributors-list/contributors-list.component.ts
new file mode 100644
index 000000000..89cc6ab67
--- /dev/null
+++ b/src/app/shared/components/contributors-list/contributors-list.component.ts
@@ -0,0 +1,19 @@
+import { TranslatePipe } from '@ngx-translate/core';
+
+import { ChangeDetectionStrategy, Component, input } from '@angular/core';
+import { RouterLink } from '@angular/router';
+
+import { ContributorModel } from '@shared/models';
+
+@Component({
+ selector: 'osf-contributors-list',
+ imports: [RouterLink, TranslatePipe],
+ templateUrl: './contributors-list.component.html',
+ styleUrl: './contributors-list.component.scss',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class ContributorsListComponent {
+ contributors = input.required[]>();
+ readonly = input(false);
+ anonymous = input(false);
+}
diff --git a/src/app/shared/components/contributors/contributors-list/contributors-list.component.html b/src/app/shared/components/contributors/contributors-table/contributors-table.component.html
similarity index 100%
rename from src/app/shared/components/contributors/contributors-list/contributors-list.component.html
rename to src/app/shared/components/contributors/contributors-table/contributors-table.component.html
diff --git a/src/app/shared/components/contributors/contributors-list/contributors-list.component.scss b/src/app/shared/components/contributors/contributors-table/contributors-table.component.scss
similarity index 100%
rename from src/app/shared/components/contributors/contributors-list/contributors-list.component.scss
rename to src/app/shared/components/contributors/contributors-table/contributors-table.component.scss
diff --git a/src/app/shared/components/contributors/contributors-list/contributors-list.component.spec.ts b/src/app/shared/components/contributors/contributors-table/contributors-table.component.spec.ts
similarity index 89%
rename from src/app/shared/components/contributors/contributors-list/contributors-list.component.spec.ts
rename to src/app/shared/components/contributors/contributors-table/contributors-table.component.spec.ts
index 9c0705668..c48539324 100644
--- a/src/app/shared/components/contributors/contributors-list/contributors-list.component.spec.ts
+++ b/src/app/shared/components/contributors/contributors-table/contributors-table.component.spec.ts
@@ -4,23 +4,23 @@ import { DialogService } from 'primeng/dynamicdialog';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { ContributorPermission } from '@shared/enums';
-import { MOCK_CONTRIBUTOR, MOCK_CONTRIBUTOR_WITHOUT_HISTORY, TranslateServiceMock } from '@shared/mocks';
-import { ContributorModel } from '@shared/models';
+import { ContributorPermission } from '@osf/shared/enums';
+import { MOCK_CONTRIBUTOR, MOCK_CONTRIBUTOR_WITHOUT_HISTORY, TranslateServiceMock } from '@osf/shared/mocks';
+import { ContributorModel } from '@osf/shared/models';
-import { ContributorsListComponent } from './contributors-list.component';
+import { ContributorsTableComponent } from './contributors-table.component';
-describe('ContributorsListComponent', () => {
- let component: ContributorsListComponent;
- let fixture: ComponentFixture;
+describe('ContributorsTableComponent', () => {
+ let component: ContributorsTableComponent;
+ let fixture: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
- imports: [ContributorsListComponent],
+ imports: [ContributorsTableComponent],
providers: [MockProviders(DialogService), TranslateServiceMock],
}).compileComponents();
- fixture = TestBed.createComponent(ContributorsListComponent);
+ fixture = TestBed.createComponent(ContributorsTableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
@@ -128,6 +128,7 @@ describe('ContributorsListComponent', () => {
type: 'user',
isBibliographic: true,
isCurator: true,
+ index: 0,
isUnregisteredContributor: false,
fullName: 'Minimal User',
givenName: 'Minimal User',
diff --git a/src/app/shared/components/contributors/contributors-list/contributors-list.component.ts b/src/app/shared/components/contributors/contributors-table/contributors-table.component.ts
similarity index 84%
rename from src/app/shared/components/contributors/contributors-list/contributors-list.component.ts
rename to src/app/shared/components/contributors/contributors-table/contributors-table.component.ts
index 72e7f96c3..2e8eda2a3 100644
--- a/src/app/shared/components/contributors/contributors-list/contributors-list.component.ts
+++ b/src/app/shared/components/contributors/contributors-table/contributors-table.component.ts
@@ -11,23 +11,22 @@ import { ChangeDetectionStrategy, Component, computed, inject, input, output, si
import { FormsModule } from '@angular/forms';
import { ModeratorPermission } from '@osf/features/moderation/enums';
+import { EducationHistoryDialogComponent } from '@osf/shared/components/education-history-dialog/education-history-dialog.component';
+import { EmploymentHistoryDialogComponent } from '@osf/shared/components/employment-history-dialog/employment-history-dialog.component';
+import { SelectComponent } from '@osf/shared/components/select/select.component';
import { DEFAULT_TABLE_PARAMS, PERMISSION_OPTIONS } from '@osf/shared/constants';
+import { ContributorPermission } from '@osf/shared/enums';
import { ContributorModel, SelectOption, TableParameters } from '@osf/shared/models';
-import { ContributorPermission } from '@shared/enums';
-
-import { EducationHistoryDialogComponent } from '../../education-history-dialog/education-history-dialog.component';
-import { EmploymentHistoryDialogComponent } from '../../employment-history-dialog/employment-history-dialog.component';
-import { SelectComponent } from '../../select/select.component';
@Component({
- selector: 'osf-contributors-list',
+ selector: 'osf-contributors-table',
imports: [TranslatePipe, FormsModule, TableModule, Tooltip, Checkbox, Skeleton, Button, SelectComponent],
- templateUrl: './contributors-list.component.html',
- styleUrl: './contributors-list.component.scss',
+ templateUrl: './contributors-table.component.html',
+ styleUrl: './contributors-table.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [DialogService],
})
-export class ContributorsListComponent {
+export class ContributorsTableComponent {
contributors = input([]);
isLoading = input(false);
showCurator = input(false);
diff --git a/src/app/shared/components/contributors/index.ts b/src/app/shared/components/contributors/index.ts
index 8e74a5fc4..1c1ae3307 100644
--- a/src/app/shared/components/contributors/index.ts
+++ b/src/app/shared/components/contributors/index.ts
@@ -1,3 +1,3 @@
export * from './add-contributor-dialog/add-contributor-dialog.component';
export * from './add-unregistered-contributor-dialog/add-unregistered-contributor-dialog.component';
-export * from './contributors-list/contributors-list.component';
+export * from './contributors-table/contributors-table.component';
diff --git a/src/app/shared/components/index.ts b/src/app/shared/components/index.ts
index 91e12717b..e4357154a 100644
--- a/src/app/shared/components/index.ts
+++ b/src/app/shared/components/index.ts
@@ -3,6 +3,7 @@ export { AffiliatedInstitutionSelectComponent } from './affiliated-institution-s
export { AffiliatedInstitutionsViewComponent } from './affiliated-institutions-view/affiliated-institutions-view.component';
export { BarChartComponent } from './bar-chart/bar-chart.component';
export { ConfirmEmailComponent } from './confirm-email/confirm-email.component';
+export { ContributorsListComponent } from './contributors-list/contributors-list.component';
export { CopyButtonComponent } from './copy-button/copy-button.component';
export { CustomPaginatorComponent } from './custom-paginator/custom-paginator.component';
export { DataResourcesComponent } from './data-resources/data-resources.component';
diff --git a/src/app/shared/components/registration-card/registration-card.component.html b/src/app/shared/components/registration-card/registration-card.component.html
index d74aac4c3..ed509ab86 100644
--- a/src/app/shared/components/registration-card/registration-card.component.html
+++ b/src/app/shared/components/registration-card/registration-card.component.html
@@ -36,15 +36,9 @@
-
{{ 'project.overview.metadata.contributors' | translate }}:
-
- @for (contributor of registrationData().contributors; track contributor) {
- {{ contributor.fullName }}
- @if (!$last) {
- ,
- }
- }
-
+
{{ 'common.labels.contributors' | translate }}:
+
+
diff --git a/src/app/shared/components/registration-card/registration-card.component.ts b/src/app/shared/components/registration-card/registration-card.component.ts
index 0456d733f..68be76b33 100644
--- a/src/app/shared/components/registration-card/registration-card.component.ts
+++ b/src/app/shared/components/registration-card/registration-card.component.ts
@@ -15,6 +15,7 @@ import { CreateSchemaResponse, FetchAllSchemaResponses, RegistriesSelectors } fr
import { RegistrationReviewStates, RevisionReviewStates, UserPermissions } from '@osf/shared/enums';
import { RegistrationCard } from '@osf/shared/models';
+import { ContributorsListComponent } from '../contributors-list/contributors-list.component';
import { DataResourcesComponent } from '../data-resources/data-resources.component';
import { IconComponent } from '../icon/icon.component';
import { StatusBadgeComponent } from '../status-badge/status-badge.component';
@@ -32,6 +33,7 @@ import { TruncatedTextComponent } from '../truncated-text/truncated-text.compone
DataResourcesComponent,
IconComponent,
TruncatedTextComponent,
+ ContributorsListComponent,
],
templateUrl: './registration-card.component.html',
styleUrl: './registration-card.component.scss',
diff --git a/src/app/shared/components/resource-metadata/resource-metadata.component.html b/src/app/shared/components/resource-metadata/resource-metadata.component.html
index c9f8f8b7c..db627deaf 100644
--- a/src/app/shared/components/resource-metadata/resource-metadata.component.html
+++ b/src/app/shared/components/resource-metadata/resource-metadata.component.html
@@ -15,19 +15,13 @@
{{ 'project.overview.metadata.title' | translate }}
-
{{ 'project.overview.metadata.contributors' | translate }}
+
{{ 'common.labels.contributors' | translate }}
- @if (!resource.isAnonymous) {
- @for (contributor of resource.contributors; track contributor.id) {
-
- }
- } @else {
-
{{ 'project.overview.metadata.anonymousContributors' | translate }}
- }
+
diff --git a/src/app/shared/components/resource-metadata/resource-metadata.component.ts b/src/app/shared/components/resource-metadata/resource-metadata.component.ts
index bb6e0dd48..f1ef25b3a 100644
--- a/src/app/shared/components/resource-metadata/resource-metadata.component.ts
+++ b/src/app/shared/components/resource-metadata/resource-metadata.component.ts
@@ -13,6 +13,7 @@ import { CurrentResourceType } from '@osf/shared/enums';
import { ResourceOverview } from '@shared/models';
import { AffiliatedInstitutionsViewComponent } from '../affiliated-institutions-view/affiliated-institutions-view.component';
+import { ContributorsListComponent } from '../contributors-list/contributors-list.component';
import { ResourceCitationsComponent } from '../resource-citations/resource-citations.component';
import { TruncatedTextComponent } from '../truncated-text/truncated-text.component';
@@ -28,6 +29,7 @@ import { TruncatedTextComponent } from '../truncated-text/truncated-text.compone
ResourceCitationsComponent,
OverviewCollectionsComponent,
AffiliatedInstitutionsViewComponent,
+ ContributorsListComponent,
],
templateUrl: './resource-metadata.component.html',
styleUrl: './resource-metadata.component.scss',
diff --git a/src/app/shared/constants/social-links.const.ts b/src/app/shared/constants/social-links.const.ts
index 36a8a9206..e7f18b186 100644
--- a/src/app/shared/constants/social-links.const.ts
+++ b/src/app/shared/constants/social-links.const.ts
@@ -39,7 +39,7 @@ export const SOCIAL_LINKS: SocialLinksModel[] = [
address: 'https://impactstory.org/u/',
placeholder: 'profileID',
key: 'impactStory',
- icon: 'impactStory.svg',
+ icon: 'impactStory.png',
},
{
id: 6,
diff --git a/src/app/shared/mappers/collections/collections.mapper.ts b/src/app/shared/mappers/collections/collections.mapper.ts
index 29e7d6949..ea2b92d41 100644
--- a/src/app/shared/mappers/collections/collections.mapper.ts
+++ b/src/app/shared/mappers/collections/collections.mapper.ts
@@ -14,7 +14,7 @@ import {
CollectionSubmissionPayloadJsonApi,
CollectionSubmissionWithGuid,
CollectionSubmissionWithGuidJsonApi,
- ContributorShortInfoModel,
+ ContributorModel,
PaginatedData,
ResponseJsonApi,
} from '@osf/shared/models';
@@ -189,7 +189,7 @@ export class CollectionsMapper {
dataType: submission.attributes.data_type,
disease: submission.attributes.disease,
gradeLevels: submission.attributes.grade_levels,
- contributors: [] as ContributorShortInfoModel[],
+ contributors: [] as ContributorModel[],
}));
}
diff --git a/src/app/shared/mappers/components/components.mapper.ts b/src/app/shared/mappers/components/components.mapper.ts
index 762e19d95..57a6d0ec8 100644
--- a/src/app/shared/mappers/components/components.mapper.ts
+++ b/src/app/shared/mappers/components/components.mapper.ts
@@ -1,5 +1,7 @@
import { ComponentGetResponseJsonApi, ComponentOverview } from '@shared/models';
+import { ContributorsMapper } from '../contributors';
+
export class ComponentsMapper {
static fromGetComponentResponse(response: ComponentGetResponseJsonApi): ComponentOverview {
return {
@@ -8,14 +10,7 @@ export class ComponentsMapper {
title: response.attributes.title,
description: response.attributes.description,
public: response.attributes.public,
- contributors: response.embeds.bibliographic_contributors.data.map((contributor) => ({
- id: contributor.embeds.users?.data?.id,
- familyName: contributor.embeds.users?.data?.attributes?.family_name,
- fullName: contributor.embeds.users?.data?.attributes?.full_name,
- givenName: contributor.embeds.users?.data?.attributes?.given_name,
- middleName: contributor.embeds.users?.data?.attributes?.middle_name,
- type: contributor.embeds.users?.data?.type,
- })),
+ contributors: ContributorsMapper.getContributors(response?.embeds?.bibliographic_contributors?.data),
currentUserPermissions: response.attributes?.current_user_permissions || [],
};
}
diff --git a/src/app/shared/mappers/contributors/contributors.mapper.ts b/src/app/shared/mappers/contributors/contributors.mapper.ts
index 22cd79f88..0be93bef9 100644
--- a/src/app/shared/mappers/contributors/contributors.mapper.ts
+++ b/src/app/shared/mappers/contributors/contributors.mapper.ts
@@ -11,47 +11,51 @@ import {
} from '@osf/shared/models';
export class ContributorsMapper {
- static fromResponse(response: ContributorDataJsonApi[] | undefined): ContributorModel[] {
+ static getContributors(response: ContributorDataJsonApi[] | undefined): ContributorModel[] {
if (!response) {
return [];
}
- return response
- .filter((contributor) => !contributor?.embeds?.users?.errors)
- .map((contributor) => this.fromContributorResponse(contributor));
+ return response.map((contributor) => this.getContributor(contributor));
}
- static fromContributorResponse(response: ContributorDataJsonApi): ContributorModel {
+ static getContributor(response: ContributorDataJsonApi): ContributorModel {
+ const userEmbed = response.embeds.users;
+ const errorMeta = userEmbed?.errors && userEmbed.errors.length > 0 ? userEmbed.errors[0]?.meta : null;
+ const userData = userEmbed?.data;
+
return {
id: response.id,
- userId: response.embeds?.users?.data?.id || '',
type: response.type,
isBibliographic: response.attributes.bibliographic,
isUnregisteredContributor: !!response.attributes.unregistered_contributor,
isCurator: response.attributes.is_curator,
permission: response.attributes.permission,
index: response.attributes.index,
- fullName: response.embeds?.users?.data?.attributes?.full_name || '',
- givenName: response.embeds?.users?.data?.attributes?.given_name || '',
- familyName: response.embeds?.users?.data?.attributes?.family_name || '',
- education: response.embeds?.users?.data?.attributes?.education || '',
- employment: response.embeds?.users?.data?.attributes?.employment || '',
+ userId: errorMeta ? '' : userData?.id || '',
+ fullName: errorMeta ? errorMeta?.full_name : userData?.attributes?.full_name || '',
+ givenName: errorMeta ? errorMeta?.given_name : userData?.attributes?.given_name || '',
+ familyName: errorMeta ? errorMeta?.family_name : userData?.attributes?.family_name || '',
+ education: errorMeta ? [] : userData?.attributes?.education || [],
+ employment: errorMeta ? [] : userData?.attributes?.employment || [],
};
}
static getContributorShortInfo(response: ContributorDataJsonApi[] | undefined): ContributorShortInfoModel[] {
- const contributors = this.fromResponse(response);
+ const contributors = this.getContributors(response);
return contributors.map((contributor) => ({
id: contributor.id,
userId: contributor.userId,
fullName: contributor.fullName,
+ isUnregisteredContributor: contributor.isUnregisteredContributor,
+ isBibliographic: contributor.isBibliographic,
+ index: contributor.index,
+ permission: contributor.permission,
}));
}
- static fromUsersWithPaginationGetResponse(
- response: ResponseJsonApi
- ): PaginatedData {
+ static getPaginatedUsers(response: ResponseJsonApi): PaginatedData {
return {
data: response.data.map(
(user) =>
diff --git a/src/app/shared/mappers/duplicates.mapper.ts b/src/app/shared/mappers/duplicates.mapper.ts
index 9ce728059..b003f6909 100644
--- a/src/app/shared/mappers/duplicates.mapper.ts
+++ b/src/app/shared/mappers/duplicates.mapper.ts
@@ -16,7 +16,7 @@ export class DuplicatesMapper {
dateModified: duplicate.attributes.date_modified,
public: duplicate.attributes.public,
currentUserPermissions: duplicate.attributes.current_user_permissions,
- contributors: ContributorsMapper.getContributorShortInfo(duplicate.embeds.bibliographic_contributors.data),
+ contributors: ContributorsMapper.getContributors(duplicate.embeds.bibliographic_contributors.data),
})),
totalCount: response.meta.total,
};
diff --git a/src/app/shared/mappers/registration/registration.mapper.ts b/src/app/shared/mappers/registration/registration.mapper.ts
index 71ac07cf5..efc7eb644 100644
--- a/src/app/shared/mappers/registration/registration.mapper.ts
+++ b/src/app/shared/mappers/registration/registration.mapper.ts
@@ -68,7 +68,7 @@ export class RegistrationMapper {
registrationTemplate: registration.embeds?.registration_schema?.data?.attributes?.name || '',
registry: registration.embeds?.provider?.data?.attributes?.name || '',
public: registration.attributes.public,
- contributors: ContributorsMapper.getContributorShortInfo(registration.embeds?.bibliographic_contributors?.data),
+ contributors: ContributorsMapper.getContributors(registration.embeds?.bibliographic_contributors?.data),
currentUserPermissions: registration.attributes.current_user_permissions,
};
}
@@ -91,7 +91,7 @@ export class RegistrationMapper {
hasMaterials: registration.attributes.has_materials,
hasPapers: registration.attributes.has_papers,
hasSupplements: registration.attributes.has_supplements,
- contributors: ContributorsMapper.getContributorShortInfo(registration.embeds?.bibliographic_contributors?.data),
+ contributors: ContributorsMapper.getContributors(registration?.embeds?.bibliographic_contributors?.data),
rootParentId: registration.relationships.root?.data?.id,
currentUserPermissions: registration.attributes.current_user_permissions,
};
diff --git a/src/app/shared/models/collections/collections.models.ts b/src/app/shared/models/collections/collections.models.ts
index f26e1b5d8..eba654ae7 100644
--- a/src/app/shared/models/collections/collections.models.ts
+++ b/src/app/shared/models/collections/collections.models.ts
@@ -1,7 +1,7 @@
import { CollectionSubmissionReviewAction } from '@osf/features/moderation/models';
import { Brand } from '../brand.model';
-import { ContributorShortInfoModel } from '../contributors';
+import { ContributorModel } from '../contributors';
import { BaseProviderModel } from '../provider';
export interface CollectionProvider extends BaseProviderModel {
@@ -83,7 +83,7 @@ export interface CollectionSubmissionWithGuid {
dataType: string;
disease: string;
gradeLevels: string;
- contributors?: ContributorShortInfoModel[];
+ contributors?: ContributorModel[];
creator?: {
id: string;
fullName: string;
diff --git a/src/app/shared/models/components/components.models.ts b/src/app/shared/models/components/components.models.ts
index be72c402a..ed25e28c2 100644
--- a/src/app/shared/models/components/components.models.ts
+++ b/src/app/shared/models/components/components.models.ts
@@ -1,19 +1,14 @@
import { UserPermissions } from '@osf/shared/enums';
+import { ContributorDataJsonApi, ContributorModel } from '../contributors';
+
export interface ComponentOverview {
id: string;
type: string;
title: string;
description: string;
public: boolean;
- contributors: {
- familyName: string;
- fullName: string;
- givenName: string;
- middleName: string;
- id: string;
- type: string;
- }[];
+ contributors: ContributorModel[];
currentUserPermissions: UserPermissions[];
}
@@ -28,22 +23,7 @@ export interface ComponentGetResponseJsonApi {
};
embeds: {
bibliographic_contributors: {
- data: {
- embeds: {
- users: {
- data: {
- id: string;
- type: string;
- attributes: {
- family_name: string;
- full_name: string;
- given_name: string;
- middle_name: string;
- };
- };
- };
- };
- }[];
+ data: ContributorDataJsonApi[];
};
};
}
diff --git a/src/app/shared/models/contributors/contributor.model.ts b/src/app/shared/models/contributors/contributor.model.ts
index 7630906df..2272110b8 100644
--- a/src/app/shared/models/contributors/contributor.model.ts
+++ b/src/app/shared/models/contributors/contributor.model.ts
@@ -17,4 +17,7 @@ export interface ContributorModel {
education: Education[];
}
-export type ContributorShortInfoModel = Pick;
+export type ContributorShortInfoModel = Pick<
+ ContributorModel,
+ 'id' | 'userId' | 'fullName' | 'isUnregisteredContributor' | 'isBibliographic' | 'index' | 'permission'
+>;
diff --git a/src/app/shared/models/duplicates/duplicate.model.ts b/src/app/shared/models/duplicates/duplicate.model.ts
index d940c9558..7edeb6d13 100644
--- a/src/app/shared/models/duplicates/duplicate.model.ts
+++ b/src/app/shared/models/duplicates/duplicate.model.ts
@@ -1,4 +1,4 @@
-import { ContributorShortInfoModel } from '../contributors';
+import { ContributorModel } from '../contributors';
export interface Duplicate {
id: string;
@@ -9,7 +9,7 @@ export interface Duplicate {
dateModified: string;
public: boolean;
currentUserPermissions: string[];
- contributors: ContributorShortInfoModel[];
+ contributors: ContributorModel[];
}
export interface DuplicatesWithTotal {
diff --git a/src/app/shared/models/my-resources/my-resources.models.ts b/src/app/shared/models/my-resources/my-resources.models.ts
index 201a4d117..e5f268377 100644
--- a/src/app/shared/models/my-resources/my-resources.models.ts
+++ b/src/app/shared/models/my-resources/my-resources.models.ts
@@ -1,4 +1,4 @@
-import { ContributorDataJsonApi, ContributorShortInfoModel, ResponseJsonApi } from '@shared/models';
+import { ContributorDataJsonApi, ContributorModel, ResponseJsonApi } from '@shared/models';
export type MyResourcesItemResponseJsonApi = ResponseJsonApi;
@@ -20,13 +20,6 @@ export interface MyResourcesItemGetResponseJsonApi {
};
}
-export interface MyResourcesContributor {
- familyName: string;
- fullName: string;
- givenName: string;
- middleName: string;
-}
-
export interface MyResourcesItem {
id: string;
type: string;
@@ -34,5 +27,5 @@ export interface MyResourcesItem {
dateCreated: string;
dateModified: string;
isPublic: boolean;
- contributors: ContributorShortInfoModel[];
+ contributors: ContributorModel[];
}
diff --git a/src/app/shared/models/registration/registration-card.model.ts b/src/app/shared/models/registration/registration-card.model.ts
index 625b4995d..af67f9011 100644
--- a/src/app/shared/models/registration/registration-card.model.ts
+++ b/src/app/shared/models/registration/registration-card.model.ts
@@ -9,7 +9,7 @@ export interface RegistrationCard {
status: RegistryStatus;
dateCreated: string;
dateModified: string;
- contributors: Partial[];
+ contributors: ContributorModel[];
registrationTemplate: string;
registry: string;
resources?: Record;
diff --git a/src/app/shared/models/resource-overview.model.ts b/src/app/shared/models/resource-overview.model.ts
index 30fc7132c..963580adf 100644
--- a/src/app/shared/models/resource-overview.model.ts
+++ b/src/app/shared/models/resource-overview.model.ts
@@ -1,6 +1,5 @@
-import { ProjectOverviewContributor } from '@osf/features/project/overview/models';
-
import { IdTypeModel } from './common';
+import { ContributorModel } from './contributors';
import { Identifier } from './identifiers';
import { Institution } from './institutions';
import { LicensesOption } from './license.model';
@@ -50,7 +49,7 @@ export interface ResourceOverview {
currentUserIsContributorOrGroupMember: boolean;
wikiEnabled: boolean;
subjects: SubjectModel[];
- contributors: ProjectOverviewContributor[];
+ contributors: ContributorModel[];
customCitation: string | null;
region?: IdTypeModel;
affiliatedInstitutions?: Institution[];
diff --git a/src/app/shared/services/collections.service.ts b/src/app/shared/services/collections.service.ts
index fd21cc40c..6f903ce05 100644
--- a/src/app/shared/services/collections.service.ts
+++ b/src/app/shared/services/collections.service.ts
@@ -24,7 +24,7 @@ import {
CollectionSubmissionTargetType,
CollectionSubmissionWithGuid,
CollectionSubmissionWithGuidJsonApi,
- ContributorShortInfoModel,
+ ContributorModel,
ContributorsResponseJsonApi,
JsonApiResponse,
PaginatedData,
@@ -201,14 +201,14 @@ export class CollectionsService {
>(`${this.apiUrl}/collection_submission_actions/`, params);
}
- private getCollectionContributors(contributorsUrl: string): Observable {
+ private getCollectionContributors(contributorsUrl: string): Observable {
const params: Record = {
'fields[users]': 'full_name',
};
return this.jsonApiService
.get(contributorsUrl, params)
- .pipe(map((response) => ContributorsMapper.getContributorShortInfo(response.data)));
+ .pipe(map((response) => ContributorsMapper.getContributors(response.data)));
}
private fetchUserCollectionSubmissionsByStatus(
diff --git a/src/app/shared/services/contributors.service.ts b/src/app/shared/services/contributors.service.ts
index 86d87823b..e350ed35a 100644
--- a/src/app/shared/services/contributors.service.ts
+++ b/src/app/shared/services/contributors.service.ts
@@ -52,7 +52,7 @@ export class ContributorsService {
return this.jsonApiService
.get(`${baseUrl}/`)
- .pipe(map((response) => ContributorsMapper.fromResponse(response.data)));
+ .pipe(map((response) => ContributorsMapper.getContributors(response.data)));
}
searchUsers(value: string, page = 1): Observable> {
@@ -60,7 +60,7 @@ export class ContributorsService {
return this.jsonApiService
.get>(baseUrl)
- .pipe(map((response) => ContributorsMapper.fromUsersWithPaginationGetResponse(response)));
+ .pipe(map((response) => ContributorsMapper.getPaginatedUsers(response)));
}
addContributor(
@@ -75,7 +75,7 @@ export class ContributorsService {
return this.jsonApiService
.post(baseUrl, contributorData)
- .pipe(map((contributor) => ContributorsMapper.fromContributorResponse(contributor.data)));
+ .pipe(map((contributor) => ContributorsMapper.getContributor(contributor.data)));
}
updateContributor(
@@ -89,7 +89,7 @@ export class ContributorsService {
return this.jsonApiService
.patch(baseUrl, contributorData)
- .pipe(map((contributor) => ContributorsMapper.fromContributorResponse(contributor)));
+ .pipe(map((contributor) => ContributorsMapper.getContributor(contributor)));
}
deleteContributor(resourceType: ResourceType, resourceId: string, userId: string): Observable {
diff --git a/src/app/shared/services/files.service.ts b/src/app/shared/services/files.service.ts
index 8970afbe4..b7da9c0d5 100644
--- a/src/app/shared/services/files.service.ts
+++ b/src/app/shared/services/files.service.ts
@@ -232,10 +232,10 @@ export class FilesService {
);
}
- getResourceContributors(resourceId: string, resourceType: string): Observable[]> {
+ getResourceContributors(resourceId: string, resourceType: string): Observable {
return this.jsonApiService
.get(`${this.apiUrl}/${resourceType}/${resourceId}/bibliographic_contributors/`)
- .pipe(map((response) => ContributorsMapper.fromResponse(response.data)));
+ .pipe(map((response) => ContributorsMapper.getContributors(response.data)));
}
patchFileMetadata(data: PatchFileMetadata, fileGuid: string): Observable {