aboutsummaryrefslogtreecommitdiffstats
path: root/services/context
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-12-11 14:33:24 +0800
committerGitHub <noreply@github.com>2024-12-11 06:33:24 +0000
commite619384098419569e570796a57ee6af4948067ae (patch)
tree9c5413be580d91ed9912878f80336eab89543670 /services/context
parent734ddf71180a9bf843d12dd9664eed28ba1a5748 (diff)
downloadgitea-e619384098419569e570796a57ee6af4948067ae.tar.gz
gitea-e619384098419569e570796a57ee6af4948067ae.zip
Add label/author/assignee filters to the user/org home issue list (#32779)
Replace #26661, fix #25979 Not perfect, but usable and much better than before. Since it is quite complex, I am not quite sure whether there would be any regression, if any, I will fix in first time. I have tested the related pages many times: issue list, milestone issue list, project view, user issue list, org issue list.
Diffstat (limited to 'services/context')
-rw-r--r--services/context/pagination.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/services/context/pagination.go b/services/context/pagination.go
index fb2ef699ce..42117cf96d 100644
--- a/services/context/pagination.go
+++ b/services/context/pagination.go
@@ -6,6 +6,7 @@ package context
import (
"fmt"
"html/template"
+ "net/http"
"net/url"
"strings"
@@ -32,6 +33,18 @@ func (p *Pagination) AddParamString(key, value string) {
p.urlParams = append(p.urlParams, urlParam)
}
+func (p *Pagination) AddParamFromRequest(req *http.Request) {
+ for key, values := range req.URL.Query() {
+ if key == "page" || len(values) == 0 {
+ continue
+ }
+ for _, value := range values {
+ urlParam := fmt.Sprintf("%s=%v", key, url.QueryEscape(value))
+ p.urlParams = append(p.urlParams, urlParam)
+ }
+ }
+}
+
// GetParams returns the configured URL params
func (p *Pagination) GetParams() template.URL {
return template.URL(strings.Join(p.urlParams, "&"))