aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-07-28 23:05:24 +0800
committerGitHub <noreply@github.com>2023-07-28 23:05:24 +0800
commitd88fed0db12813b36c065f9602a793f3f5884dab (patch)
tree7b1a1f0ef640f19e2054722a141b3c6aeb149d24
parent7866a6e0e25cf87b298e046bb38f4d68c35529a7 (diff)
downloadgitea-d88fed0db12813b36c065f9602a793f3f5884dab.tar.gz
gitea-d88fed0db12813b36c065f9602a793f3f5884dab.zip
Hide branch/tag icon if branches/tags are empty (#26204)
The branch/tag icons aren't hidden correctly if there is no branch/tag. This PR fixes it.
-rw-r--r--web_src/js/features/repo-diff-commit.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/web_src/js/features/repo-diff-commit.js b/web_src/js/features/repo-diff-commit.js
index 968f318e63..bc591fa37d 100644
--- a/web_src/js/features/repo-diff-commit.js
+++ b/web_src/js/features/repo-diff-commit.js
@@ -16,7 +16,7 @@ async function loadBranchesAndTags(area, loadingButton) {
function addTags(area, tags) {
const tagArea = area.querySelector('.tag-area');
- toggleElem(tagArea, tags.length > 0);
+ toggleElem(tagArea.parentElement, tags.length > 0);
for (const tag of tags) {
addLink(tagArea, tag.web_link, tag.name);
}
@@ -25,7 +25,7 @@ function addTags(area, tags) {
function addBranches(area, branches, defaultBranch) {
const defaultBranchTooltip = area.getAttribute('data-text-default-branch-tooltip');
const branchArea = area.querySelector('.branch-area');
- toggleElem(branchArea, branches.length > 0);
+ toggleElem(branchArea.parentElement, branches.length > 0);
for (const branch of branches) {
const tooltip = defaultBranch === branch.name ? defaultBranchTooltip : null;
addLink(branchArea, branch.web_link, branch.name, tooltip);