1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Remove AddParamIfExist(AddParam) (#29841)

Follow #29834

Remove AddParamIfExist, use "AddParamString" instead, it should clearly
know what is being added into the parameters.
This commit is contained in:
wxiaoguang
2024-03-16 20:07:56 +08:00
committed by GitHub
parent 66902d89e5
commit a889381664
17 changed files with 55 additions and 58 deletions

View File

@@ -4,6 +4,7 @@
package admin
import (
"fmt"
"net/http"
"net/url"
"strings"
@@ -84,7 +85,7 @@ func UnadoptedRepos(ctx *context.Context) {
if !doSearch {
pager := context.NewPagination(0, opts.PageSize, opts.Page, 5)
pager.SetDefaultParams(ctx)
pager.AddParamIfExist("search", ctx.Data["search"])
pager.AddParamString("search", fmt.Sprint(doSearch))
ctx.Data["Page"] = pager
ctx.HTML(http.StatusOK, tplUnadoptedRepos)
return
@@ -98,7 +99,7 @@ func UnadoptedRepos(ctx *context.Context) {
ctx.Data["Dirs"] = repoNames
pager := context.NewPagination(count, opts.PageSize, opts.Page, 5)
pager.SetDefaultParams(ctx)
pager.AddParamIfExist("search", ctx.Data["search"])
pager.AddParamString("search", fmt.Sprint(doSearch))
ctx.Data["Page"] = pager
ctx.HTML(http.StatusOK, tplUnadoptedRepos)
}