From 7a171ecf09014d9d4c4e5f9039e4af21b9799056 Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Wed, 27 Sep 2023 04:53:47 +0000
Subject: [PATCH 01/12] improve
---
routers/web/repo/issue.go | 4 +++
routers/web/repo/milestone.go | 3 ++
templates/repo/issue/filters.tmpl | 18 +++++++++++
templates/repo/issue/milestones.tmpl | 46 +++-------------------------
templates/repo/issue/openclose.tmpl | 12 +++++---
templates/repo/issue/search.tmpl | 4 ++-
6 files changed, 40 insertions(+), 47 deletions(-)
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index f4aa357fac77b..110f19b7dd3b0 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -417,6 +417,10 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
ctx.Data["PinnedIssues"] = pinned
ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.Doer.IsAdmin)
ctx.Data["IssueStats"] = issueStats
+ ctx.Data["OpenCount"] = issueStats.OpenCount
+ ctx.Data["ClosedCount"] = issueStats.ClosedCount
+ ctx.Data["OpenLink"] = fmt.Sprintf("%s?q=%s&type=%s&sort=%s&state=open&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d", ctx.Link, keyword, viewType, sortType, selectLabels, mentionedID, projectID, assigneeID, posterID)
+ ctx.Data["ClosedLink"] = fmt.Sprintf("%s?q=%s&type=%s&sort=%s&state=closed&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d", ctx.Link, keyword, viewType, sortType, selectLabels, mentionedID, projectID, assigneeID, posterID)
ctx.Data["SelLabelIDs"] = labelIDs
ctx.Data["SelectLabels"] = selectLabels
ctx.Data["ViewType"] = viewType
diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go
index df52ca3528984..d52b2cecc6f63 100644
--- a/routers/web/repo/milestone.go
+++ b/routers/web/repo/milestone.go
@@ -4,6 +4,7 @@
package repo
import (
+ "fmt"
"net/http"
"net/url"
"time"
@@ -72,6 +73,8 @@ func Milestones(ctx *context.Context) {
}
ctx.Data["OpenCount"] = stats.OpenCount
ctx.Data["ClosedCount"] = stats.ClosedCount
+ ctx.Data["OpenLink"] = fmt.Sprintf("%s/milestones?state=open&q=%s", ctx.Repo.RepoLink, keyword)
+ ctx.Data["ClosedLink"] = fmt.Sprintf("%s/milestones?state=closed&q=%s", ctx.Repo.RepoLink, keyword)
if ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
if err := miles.LoadTotalTrackedTimes(ctx); err != nil {
diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl
index 1805a23e372a1..e53c690b26153 100644
--- a/templates/repo/issue/filters.tmpl
+++ b/templates/repo/issue/filters.tmpl
@@ -7,6 +7,23 @@
+ {{end}}
diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl
index a6cb11dde6cfa..65e487bf14cd8 100644
--- a/templates/repo/issue/milestones.tmpl
+++ b/templates/repo/issue/milestones.tmpl
@@ -2,53 +2,17 @@
{{end}}
@@ -173,13 +194,13 @@
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
\ No newline at end of file
From 4ba434699185cce8189817191108fa56fa5124a3 Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Thu, 5 Oct 2023 10:05:49 +0900
Subject: [PATCH 05/12] Update templates/repo/issue/milestone/filter_list.tmpl
Co-authored-by: puni9869 <80308335+puni9869@users.noreply.github.com>
---
templates/repo/issue/milestone/filter_list.tmpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates/repo/issue/milestone/filter_list.tmpl b/templates/repo/issue/milestone/filter_list.tmpl
index ba0dcbb55f3ab..0eea42d6ee61f 100644
--- a/templates/repo/issue/milestone/filter_list.tmpl
+++ b/templates/repo/issue/milestone/filter_list.tmpl
@@ -12,4 +12,4 @@
{{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}}
{{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}}
-
\ No newline at end of file
+
From e8e37c80c770b905f1f420eeeab3b9d8c89c827f Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Thu, 5 Oct 2023 01:12:07 +0000
Subject: [PATCH 06/12] improve format
---
templates/repo/issue/search.tmpl | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/templates/repo/issue/search.tmpl b/templates/repo/issue/search.tmpl
index 79ed1a0e21dc5..361f16fd3b1e6 100644
--- a/templates/repo/issue/search.tmpl
+++ b/templates/repo/issue/search.tmpl
@@ -2,12 +2,12 @@
{{if not .PageIsMilestones}}
-
-
-
-
-
-
+
+
+
+
+
+
{{end}}
{{template "shared/searchinput" dict "Value" .Keyword}}
{{if .PageIsIssueList}}
From 8508daf6dcdf785bc2c864c2ad944639d52512a8 Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Thu, 5 Oct 2023 01:21:31 +0000
Subject: [PATCH 07/12] improve
---
routers/web/repo/issue.go | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 56a955b01798f..99dcaf658dc35 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -247,10 +247,6 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
}
archived := ctx.FormBool("archived")
- showArchivedLabels := "false"
- if archived {
- showArchivedLabels = "true"
- }
page := ctx.FormInt("page")
if page <= 1 {
@@ -425,8 +421,8 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
ctx.Data["IssueStats"] = issueStats
ctx.Data["OpenCount"] = issueStats.OpenCount
ctx.Data["ClosedCount"] = issueStats.ClosedCount
- ctx.Data["OpenLink"] = fmt.Sprintf("%s?q=%s&type=%s&sort=%s&state=open&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d&archived=%s", ctx.Link, keyword, viewType, sortType, selectLabels, mentionedID, projectID, assigneeID, posterID, showArchivedLabels)
- ctx.Data["ClosedLink"] = fmt.Sprintf("%s?q=%s&type=%s&sort=%s&state=closed&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d&archived=%s", ctx.Link, keyword, viewType, sortType, selectLabels, mentionedID, projectID, assigneeID, posterID, showArchivedLabels)
+ ctx.Data["OpenLink"] = fmt.Sprintf("%s?q=%s&type=%s&sort=%s&state=open&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d&archived=%t", ctx.Link, keyword, viewType, sortType, selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
+ ctx.Data["ClosedLink"] = fmt.Sprintf("%s?q=%s&type=%s&sort=%s&state=closed&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d&archived=%t", ctx.Link, keyword, viewType, sortType, selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
ctx.Data["SelLabelIDs"] = labelIDs
ctx.Data["SelectLabels"] = selectLabels
ctx.Data["ViewType"] = viewType
From 3977b021d927edc36046c81896555ab63372a7fd Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Thu, 5 Oct 2023 01:35:42 +0000
Subject: [PATCH 08/12] fix lint
---
templates/repo/issue/filter_list.tmpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates/repo/issue/filter_list.tmpl b/templates/repo/issue/filter_list.tmpl
index 6876f17d47ffe..511ef7f397c5c 100644
--- a/templates/repo/issue/filter_list.tmpl
+++ b/templates/repo/issue/filter_list.tmpl
@@ -203,4 +203,4 @@
{{ctx.Locale.Tr "repo.issues.filter_sort.nearduedate"}}
{{ctx.Locale.Tr "repo.issues.filter_sort.farduedate"}}
-
\ No newline at end of file
+
From d7416ed6d81ca622e72b45187ad10d0590ff4953 Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Fri, 6 Oct 2023 00:23:10 +0000
Subject: [PATCH 09/12] improve
---
routers/web/repo/issue.go | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 99dcaf658dc35..d0f47a0c05dbd 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -421,8 +421,9 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
ctx.Data["IssueStats"] = issueStats
ctx.Data["OpenCount"] = issueStats.OpenCount
ctx.Data["ClosedCount"] = issueStats.ClosedCount
- ctx.Data["OpenLink"] = fmt.Sprintf("%s?q=%s&type=%s&sort=%s&state=open&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d&archived=%t", ctx.Link, keyword, viewType, sortType, selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
- ctx.Data["ClosedLink"] = fmt.Sprintf("%s?q=%s&type=%s&sort=%s&state=closed&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d&archived=%t", ctx.Link, keyword, viewType, sortType, selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
+ linkStr := "%s?q=%s&type=%s&sort=%s&state=%s&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d&archived=%t"
+ ctx.Data["OpenLink"] = fmt.Sprintf(linkStr, ctx.Link, keyword, viewType, sortType, "open", selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
+ ctx.Data["ClosedLink"] = fmt.Sprintf(linkStr, ctx.Link, keyword, viewType, sortType, "close", selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
ctx.Data["SelLabelIDs"] = labelIDs
ctx.Data["SelectLabels"] = selectLabels
ctx.Data["ViewType"] = viewType
From e4d02b94e6be452a579f4dbf333caf07fcd6318d Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Fri, 6 Oct 2023 00:26:43 +0000
Subject: [PATCH 10/12] improve
---
routers/web/repo/issue.go | 2 +-
routers/web/repo/milestone.go | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index d0f47a0c05dbd..9a83e67500a4a 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -423,7 +423,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
ctx.Data["ClosedCount"] = issueStats.ClosedCount
linkStr := "%s?q=%s&type=%s&sort=%s&state=%s&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d&archived=%t"
ctx.Data["OpenLink"] = fmt.Sprintf(linkStr, ctx.Link, keyword, viewType, sortType, "open", selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
- ctx.Data["ClosedLink"] = fmt.Sprintf(linkStr, ctx.Link, keyword, viewType, sortType, "close", selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
+ ctx.Data["ClosedLink"] = fmt.Sprintf(linkStr, ctx.Link, keyword, viewType, sortType, "closed", selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
ctx.Data["SelLabelIDs"] = labelIDs
ctx.Data["SelectLabels"] = selectLabels
ctx.Data["ViewType"] = viewType
diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go
index d52b2cecc6f63..2a5f7d7ebe7b7 100644
--- a/routers/web/repo/milestone.go
+++ b/routers/web/repo/milestone.go
@@ -73,8 +73,9 @@ func Milestones(ctx *context.Context) {
}
ctx.Data["OpenCount"] = stats.OpenCount
ctx.Data["ClosedCount"] = stats.ClosedCount
- ctx.Data["OpenLink"] = fmt.Sprintf("%s/milestones?state=open&q=%s", ctx.Repo.RepoLink, keyword)
- ctx.Data["ClosedLink"] = fmt.Sprintf("%s/milestones?state=closed&q=%s", ctx.Repo.RepoLink, keyword)
+ linkStr := "%s/milestones?state=%s&q=%s&sort=%s"
+ ctx.Data["OpenLink"] = fmt.Sprintf(linkStr, ctx.Repo.RepoLink, "open", keyword, sortType)
+ ctx.Data["ClosedLink"] = fmt.Sprintf(linkStr, ctx.Repo.RepoLink, "closed", keyword, sortType)
if ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
if err := miles.LoadTotalTrackedTimes(ctx); err != nil {
From df69f0fc3f6e59b67aad50a845f9714e1dc1142b Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Tue, 10 Oct 2023 05:43:09 +0000
Subject: [PATCH 11/12] add escape
---
routers/web/repo/issue.go | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index dc9c542629368..b90c0d5501843 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -422,8 +422,12 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
ctx.Data["OpenCount"] = issueStats.OpenCount
ctx.Data["ClosedCount"] = issueStats.ClosedCount
linkStr := "%s?q=%s&type=%s&sort=%s&state=%s&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d&archived=%t"
- ctx.Data["OpenLink"] = fmt.Sprintf(linkStr, ctx.Link, keyword, viewType, sortType, "open", selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
- ctx.Data["ClosedLink"] = fmt.Sprintf(linkStr, ctx.Link, keyword, viewType, sortType, "closed", selectLabels, mentionedID, projectID, assigneeID, posterID, archived)
+ ctx.Data["OpenLink"] = fmt.Sprintf(linkStr, ctx.Link,
+ url.QueryEscape(keyword), url.QueryEscape(viewType), url.QueryEscape(sortType), "open", url.QueryEscape(selectLabels),
+ mentionedID, projectID, assigneeID, posterID, archived)
+ ctx.Data["ClosedLink"] = fmt.Sprintf(linkStr, ctx.Link,
+ url.QueryEscape(keyword), url.QueryEscape(viewType), url.QueryEscape(sortType), "closed", url.QueryEscape(selectLabels),
+ mentionedID, projectID, assigneeID, posterID, archived)
ctx.Data["SelLabelIDs"] = labelIDs
ctx.Data["SelectLabels"] = selectLabels
ctx.Data["ViewType"] = viewType
From 9cacb68521a60998425aa906c4c7975eebad7ad0 Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Thu, 12 Oct 2023 00:30:31 +0000
Subject: [PATCH 12/12] add escape in milestone
---
routers/web/repo/milestone.go | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go
index 2a5f7d7ebe7b7..8ac1d5a7e7288 100644
--- a/routers/web/repo/milestone.go
+++ b/routers/web/repo/milestone.go
@@ -74,8 +74,10 @@ func Milestones(ctx *context.Context) {
ctx.Data["OpenCount"] = stats.OpenCount
ctx.Data["ClosedCount"] = stats.ClosedCount
linkStr := "%s/milestones?state=%s&q=%s&sort=%s"
- ctx.Data["OpenLink"] = fmt.Sprintf(linkStr, ctx.Repo.RepoLink, "open", keyword, sortType)
- ctx.Data["ClosedLink"] = fmt.Sprintf(linkStr, ctx.Repo.RepoLink, "closed", keyword, sortType)
+ ctx.Data["OpenLink"] = fmt.Sprintf(linkStr, ctx.Repo.RepoLink, "open",
+ url.QueryEscape(keyword), url.QueryEscape(sortType))
+ ctx.Data["ClosedLink"] = fmt.Sprintf(linkStr, ctx.Repo.RepoLink, "closed",
+ url.QueryEscape(keyword), url.QueryEscape(sortType))
if ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
if err := miles.LoadTotalTrackedTimes(ctx); err != nil {