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:
parent
6ead30dbc4
commit
e0ea3811c4
17 changed files with 53 additions and 54 deletions
|
@ -163,8 +163,8 @@ func Graph(ctx *context.Context) {
|
|||
ctx.Data["CommitCount"] = commitsCount
|
||||
|
||||
paginator := context.NewPagination(int(graphCommitsCount), setting.UI.GraphMaxCommitNum, page, 5)
|
||||
paginator.AddParam(ctx, "mode", "Mode")
|
||||
paginator.AddParam(ctx, "hide-pr-refs", "HidePRRefs")
|
||||
paginator.AddParamIfExist("mode", ctx.Data["Mode"])
|
||||
paginator.AddParamIfExist("hide-pr-refs", ctx.Data["HidePRRefs"])
|
||||
for _, branch := range branches {
|
||||
paginator.AddParamString("branch", branch)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue