From 89b6829108dab3f9f4247d7b32d3bc5a126de04d Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Wed, 16 Sep 2020 15:09:30 +0200 Subject: [PATCH] cleanup --- .../scm-hg-plugin/src/main/js/HgTagInformation.tsx | 2 +- .../src/repos/branches/components/BranchRow.tsx | 10 ++++++---- .../ui-webapp/src/repos/branches/modules/branches.ts | 4 ++-- scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx | 4 ++-- scm-ui/ui-webapp/src/repos/tags/container/TagRoot.tsx | 4 ++-- .../src/repos/tags/container/TagsOverview.tsx | 2 +- .../java/sonia/scm/api/v2/resources/BranchDto.java | 1 + 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/scm-plugins/scm-hg-plugin/src/main/js/HgTagInformation.tsx b/scm-plugins/scm-hg-plugin/src/main/js/HgTagInformation.tsx index 99c7f47d08..45254ac6ce 100644 --- a/scm-plugins/scm-hg-plugin/src/main/js/HgTagInformation.tsx +++ b/scm-plugins/scm-hg-plugin/src/main/js/HgTagInformation.tsx @@ -41,7 +41,7 @@ const HgTagInformation: FC = ({ tag }) => { <>

{t("scm-hg-plugin.information.checkoutTag")}

-        hg update {tag?.name}
+        hg update {tag.name}
       
); diff --git a/scm-ui/ui-webapp/src/repos/branches/components/BranchRow.tsx b/scm-ui/ui-webapp/src/repos/branches/components/BranchRow.tsx index 58bae4ceb5..1f0ba4d9f7 100644 --- a/scm-ui/ui-webapp/src/repos/branches/components/BranchRow.tsx +++ b/scm-ui/ui-webapp/src/repos/branches/components/BranchRow.tsx @@ -49,10 +49,12 @@ const BranchRow: FC = ({ baseUrl, branch }) => { {branch.name} - - {t("branches.overview.lastModified")} {" "} - {t("branches.overview.lastModifier")} {branch.lastModifier?.name} - + {branch?.lastModified && branch.lastModifier && ( + + {t("branches.overview.lastModified")} {" "} + {t("branches.overview.lastModifier")} {branch.lastModifier?.name} + + )} diff --git a/scm-ui/ui-webapp/src/repos/branches/modules/branches.ts b/scm-ui/ui-webapp/src/repos/branches/modules/branches.ts index 744d26d163..b2efb8720d 100644 --- a/scm-ui/ui-webapp/src/repos/branches/modules/branches.ts +++ b/scm-ui/ui-webapp/src/repos/branches/modules/branches.ts @@ -129,8 +129,8 @@ export function createBranch( // Selectors -function collectBranches(repoState: any) { - return repoState.list._embedded.branches.map((name: string) => repoState.byName[name]); +function collectBranches(repoState) { + return repoState.list._embedded.branches.map(name => repoState.byName[name]); } const memoizedBranchCollector = memoizeOne(collectBranches); diff --git a/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx b/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx index 094d310891..b0133f363a 100644 --- a/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx +++ b/scm-ui/ui-webapp/src/repos/tags/components/TagView.tsx @@ -34,7 +34,7 @@ type Props = { const TagView: FC = ({ repository, tag }) => { return ( -
+ <>
@@ -47,7 +47,7 @@ const TagView: FC = ({ repository, tag }) => { }} />
-
+ ); }; diff --git a/scm-ui/ui-webapp/src/repos/tags/container/TagRoot.tsx b/scm-ui/ui-webapp/src/repos/tags/container/TagRoot.tsx index 55f45f01c4..e147a8ba93 100644 --- a/scm-ui/ui-webapp/src/repos/tags/container/TagRoot.tsx +++ b/scm-ui/ui-webapp/src/repos/tags/container/TagRoot.tsx @@ -54,8 +54,8 @@ const TagRoot: FC = ({ repository, baseUrl }) => { }, [repository]); useEffect(() => { - const tagName = match?.params?.tag; - const link = tags && tags.length > 0 && (tags.find(tag => tag.name === tagName)?._links.self as Link).href; + const tagName = decodeURIComponent(match?.params?.tag); + const link = tags?.length > 0 && (tags.find(tag => tag.name === tagName)?._links.self as Link).href; if (link) { apiClient .get(link) diff --git a/scm-ui/ui-webapp/src/repos/tags/container/TagsOverview.tsx b/scm-ui/ui-webapp/src/repos/tags/container/TagsOverview.tsx index 35b771ae1a..c96773145e 100644 --- a/scm-ui/ui-webapp/src/repos/tags/container/TagsOverview.tsx +++ b/scm-ui/ui-webapp/src/repos/tags/container/TagsOverview.tsx @@ -54,7 +54,7 @@ const TagsOverview: FC = ({ repository, baseUrl }) => { }, [repository]); const renderTagsTable = () => { - if (!loading && tags && tags.length > 0) { + if (!loading && tags?.length > 0) { orderTags(tags); return ; } diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchDto.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchDto.java index 5e52d57152..63e98f5879 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchDto.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchDto.java @@ -54,6 +54,7 @@ public class BranchDto extends HalRepresentation { private boolean defaultBranch; @JsonInclude(JsonInclude.Include.NON_NULL) private Instant lastModified; + @JsonInclude(JsonInclude.Include.NON_NULL) private PersonDto lastModifier; BranchDto(Links links, Embedded embedded) {