mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
Ignore duplicate contributors for single changeset
Committed-by: Konstantin Schaper <konstantin.schaper@cloudogu.com>
This commit is contained in:
@@ -43,7 +43,7 @@ import {
|
||||
Level,
|
||||
SignatureIcon,
|
||||
Tooltip,
|
||||
SubSubtitle
|
||||
SubSubtitle,
|
||||
} from "@scm-manager/ui-components";
|
||||
import ContributorTable from "./ContributorTable";
|
||||
import { Link as ReactLink } from "react-router-dom";
|
||||
@@ -57,7 +57,19 @@ type Props = {
|
||||
|
||||
const countContributors = (changeset: Changeset) => {
|
||||
if (changeset.contributors) {
|
||||
return changeset.contributors.length + 1;
|
||||
const uniqueContributors: string[] = [];
|
||||
changeset.contributors
|
||||
.map((p) => p.person)
|
||||
.forEach((c) => {
|
||||
if (c.mail) {
|
||||
if (!uniqueContributors.includes(c.mail)) {
|
||||
uniqueContributors.push(c.mail);
|
||||
}
|
||||
} else {
|
||||
uniqueContributors.push(c.name);
|
||||
}
|
||||
});
|
||||
return uniqueContributors.length + 1;
|
||||
}
|
||||
return 1;
|
||||
};
|
||||
@@ -93,7 +105,7 @@ const Contributors: FC<{ changeset: Changeset }> = ({ changeset }) => {
|
||||
return (
|
||||
<div className="is-flex is-flex-direction-column mb-4">
|
||||
<div className="is-flex">
|
||||
<p className="is-ellipsis-overflow is-clickable mb-2" onClick={e => setOpen(!open)}>
|
||||
<p className="is-ellipsis-overflow is-clickable mb-2" onClick={(e) => setOpen(!open)}>
|
||||
<Icon name="angle-down" alt={t("changeset.contributors.hideList")} /> {t("changeset.contributors.list")}
|
||||
</p>
|
||||
{signatureIcon}
|
||||
@@ -105,7 +117,7 @@ const Contributors: FC<{ changeset: Changeset }> = ({ changeset }) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="is-flex is-clickable" onClick={e => setOpen(!open)}>
|
||||
<div className="is-flex is-clickable" onClick={(e) => setOpen(!open)}>
|
||||
<ContributorColumn className="is-ellipsis-overflow">
|
||||
<Icon name="angle-right" alt={t("changeset.contributors.showList")} />{" "}
|
||||
<ChangesetAuthor changeset={changeset} />
|
||||
@@ -150,7 +162,7 @@ const ChangesetDetails: FC<Props> = ({ changeset, repository, fileControlFactory
|
||||
name="changeset.description"
|
||||
props={{
|
||||
changeset,
|
||||
value: description.title
|
||||
value: description.title,
|
||||
}}
|
||||
renderAll={false}
|
||||
>
|
||||
@@ -210,7 +222,7 @@ const ChangesetDetails: FC<Props> = ({ changeset, repository, fileControlFactory
|
||||
name="changeset.description"
|
||||
props={{
|
||||
changeset,
|
||||
value: item
|
||||
value: item,
|
||||
}}
|
||||
renderAll={false}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user