aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2023-08-05 00:16:56 +0900
committerGitHub <noreply@github.com>2023-08-04 15:16:56 +0000
commit945a0cb96b26d75868e6b52405afeb4e078eb279 (patch)
tree205d353992f4326f468cde886d4500050f2b0ec7 /routers/web
parent6a7a5ea32ab61a608b52029f778e8df76b04f489 (diff)
downloadgitea-945a0cb96b26d75868e6b52405afeb4e078eb279.tar.gz
gitea-945a0cb96b26d75868e6b52405afeb4e078eb279.zip
Add highlight to selected repos in milestone dashboard (#26300)
Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/d3fa1e15-423a-4216-8a60-b02f5aa4f5d3) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/643df586-ec2f-4480-b7a0-bd252883d761) Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/user/home.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/routers/web/user/home.go b/routers/web/user/home.go
index 77974a84a2..8cc9cccc29 100644
--- a/routers/web/user/home.go
+++ b/routers/web/user/home.go
@@ -281,6 +281,19 @@ func Milestones(ctx *context.Context) {
}
}
+ showRepoIds := make(container.Set[int64], len(showRepos))
+ for _, repo := range showRepos {
+ if repo.ID > 0 {
+ showRepoIds.Add(repo.ID)
+ }
+ }
+ if len(repoIDs) == 0 {
+ repoIDs = showRepoIds.Values()
+ }
+ repoIDs = util.SliceRemoveAllFunc(repoIDs, func(v int64) bool {
+ return !showRepoIds.Contains(v)
+ })
+
var pagerCount int
if isShowClosed {
ctx.Data["State"] = "closed"
@@ -298,9 +311,7 @@ func Milestones(ctx *context.Context) {
ctx.Data["MilestoneStats"] = milestoneStats
ctx.Data["SortType"] = sortType
ctx.Data["Keyword"] = keyword
- if milestoneStats.Total() != totalMilestoneStats.Total() {
- ctx.Data["RepoIDs"] = repoIDs
- }
+ ctx.Data["RepoIDs"] = repoIDs
ctx.Data["IsShowClosed"] = isShowClosed
pager := context.NewPagination(pagerCount, setting.UI.IssuePagingNum, page, 5)