fixed error without contributors

This commit is contained in:
Sebastian Sdorra
2020-06-11 08:08:47 +02:00
parent ce2212d41f
commit 9d6621ca51
3 changed files with 11 additions and 3 deletions

View File

@@ -128,6 +128,8 @@ const Contributors: FC<PersonsProps> = ({ persons, label, displayTextOnly }) =>
}
};
const emptyListOfContributors: Person[] = [];
const ChangesetAuthor: FC<Props> = ({ changeset }) => {
const binder = useBinder();
@@ -140,7 +142,10 @@ const ChangesetAuthor: FC<Props> = ({ changeset }) => {
};
const filterContributorsByType = (type: string) => {
if (changeset.contributors) {
return changeset.contributors.filter(p => p.type === type).map(contributor => contributor.person);
}
return emptyListOfContributors;
};
const authorLine = [];

View File

@@ -36,7 +36,7 @@ export type Changeset = Collection & {
date: Date;
author: Person;
description: string;
contributors: Contributor[];
contributors?: Contributor[];
_links: Links;
_embedded: {
tags?: Tag[];

View File

@@ -66,7 +66,10 @@ const BottomMarginLevel = styled(Level)`
`;
const countContributors = (changeset: Changeset) => {
if (changeset.contributors) {
return changeset.contributors.length + 1;
}
return 1;
};
const ContributorLine = styled.div`