mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-04 20:45:52 +01:00
add co-authors if available to changeset view
refactor ChangesetAuthor.tsx get interfaces right / fix unit test / cleanup fix table layout use Set constructor injection to bind the implementation for the new changesetTrailers API cleanup / update CHANGELOG.md cleanup fix formatting
This commit is contained in:
committed by
René Pfeuffer
parent
a712c89f6a
commit
ec57aa88fa
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
import React from "react";
|
||||
import { Changeset } from "@scm-manager/ui-types";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
@@ -53,15 +52,27 @@ class ChangesetAuthor extends React.Component<Props> {
|
||||
);
|
||||
}
|
||||
|
||||
checkIfCoAuthorsExists() {
|
||||
console.log(this.props.changeset.trailerPersons.filter(p => p.trailerType === "Co-authored-by").length > 0);
|
||||
return this.props.changeset.trailerPersons.filter(p => p.trailerType === "Co-authored-by").length > 0;
|
||||
getCoAuthorsFromChangeset() {
|
||||
return this.props.changeset.trailerPersons.filter(p => p.trailerType === "Co-authored-by");
|
||||
}
|
||||
|
||||
renderCoAuthors() {
|
||||
const { t } = this.props;
|
||||
const coAuthors = this.getCoAuthorsFromChangeset();
|
||||
|
||||
return <>{t("changeset.author.prefix")}</>;
|
||||
if (coAuthors.length > 0) {
|
||||
const authorLabel = t("changeset.coAuthor.label", { count: coAuthors.length });
|
||||
return (
|
||||
<>
|
||||
{" " + t("changeset.coAuthor.prefix") + " "}
|
||||
<a title={authorLabel + ":\n" + coAuthors.map(person => "- " + person.name).join("\n")}>
|
||||
{coAuthors.length + " " + authorLabel}
|
||||
</a>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
withExtensionPoint(child: any) {
|
||||
@@ -69,14 +80,7 @@ class ChangesetAuthor extends React.Component<Props> {
|
||||
return (
|
||||
<>
|
||||
{t("changeset.author.prefix")} {child}
|
||||
{this.checkIfCoAuthorsExists() ? this.renderCoAuthors() : null}
|
||||
<ExtensionPoint
|
||||
name="changesets.author.suffix"
|
||||
props={{
|
||||
changeset: this.props.changeset
|
||||
}}
|
||||
renderAll={true}
|
||||
/>
|
||||
{this.renderCoAuthors()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user