mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 17:26:22 +01:00
fixed error without contributors
This commit is contained in:
@@ -128,6 +128,8 @@ const Contributors: FC<PersonsProps> = ({ persons, label, displayTextOnly }) =>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const emptyListOfContributors: Person[] = [];
|
||||||
|
|
||||||
const ChangesetAuthor: FC<Props> = ({ changeset }) => {
|
const ChangesetAuthor: FC<Props> = ({ changeset }) => {
|
||||||
const binder = useBinder();
|
const binder = useBinder();
|
||||||
|
|
||||||
@@ -140,7 +142,10 @@ const ChangesetAuthor: FC<Props> = ({ changeset }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const filterContributorsByType = (type: string) => {
|
const filterContributorsByType = (type: string) => {
|
||||||
|
if (changeset.contributors) {
|
||||||
return changeset.contributors.filter(p => p.type === type).map(contributor => contributor.person);
|
return changeset.contributors.filter(p => p.type === type).map(contributor => contributor.person);
|
||||||
|
}
|
||||||
|
return emptyListOfContributors;
|
||||||
};
|
};
|
||||||
|
|
||||||
const authorLine = [];
|
const authorLine = [];
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export type Changeset = Collection & {
|
|||||||
date: Date;
|
date: Date;
|
||||||
author: Person;
|
author: Person;
|
||||||
description: string;
|
description: string;
|
||||||
contributors: Contributor[];
|
contributors?: Contributor[];
|
||||||
_links: Links;
|
_links: Links;
|
||||||
_embedded: {
|
_embedded: {
|
||||||
tags?: Tag[];
|
tags?: Tag[];
|
||||||
|
|||||||
@@ -66,7 +66,10 @@ const BottomMarginLevel = styled(Level)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const countContributors = (changeset: Changeset) => {
|
const countContributors = (changeset: Changeset) => {
|
||||||
|
if (changeset.contributors) {
|
||||||
return changeset.contributors.length + 1;
|
return changeset.contributors.length + 1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ContributorLine = styled.div`
|
const ContributorLine = styled.div`
|
||||||
|
|||||||
Reference in New Issue
Block a user