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:
@@ -324,12 +324,12 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
|
||||
|
||||
pager := context.NewPagination(total, pagingNum, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
pager.AddParam(ctx, "tab", "TabName")
|
||||
pager.AddParamIfExist("tab", ctx.Data["TabName"])
|
||||
if tab != "followers" && tab != "following" && tab != "activity" && tab != "projects" {
|
||||
pager.AddParam(ctx, "language", "Language")
|
||||
pager.AddParamIfExist("language", ctx.Data["Language"])
|
||||
}
|
||||
if tab == "activity" {
|
||||
pager.AddParam(ctx, "date", "Date")
|
||||
pager.AddParamIfExist("date", ctx.Data["Date"])
|
||||
}
|
||||
ctx.Data["Page"] = pager
|
||||
}
|
||||
|
Reference in New Issue
Block a user