mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor AddParam to AddParamIfExist (#29834)
When read the code: `pager.AddParam(ctx, "search", "search")`, the question always comes: What is it doing? Where is the value from? Why "search" / "search" ? Now it is clear: `pager.AddParamIfExist("search", ctx.Data["search"])`
This commit is contained in:
@@ -106,8 +106,8 @@ func Milestones(ctx *context.Context) {
|
||||
ctx.Data["IsShowClosed"] = isShowClosed
|
||||
|
||||
pager := context.NewPagination(int(total), setting.UI.IssuePagingNum, page, 5)
|
||||
pager.AddParam(ctx, "state", "State")
|
||||
pager.AddParam(ctx, "q", "Keyword")
|
||||
pager.AddParamIfExist("state", ctx.Data["State"])
|
||||
pager.AddParamIfExist("q", ctx.Data["Keyword"])
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplMilestone)
|
||||
|
Reference in New Issue
Block a user