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:
@@ -122,7 +122,7 @@ func CodeSearch(ctx *context.Context) {
|
||||
|
||||
pager := context.NewPagination(total, setting.UI.RepoSearchPagingNum, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
pager.AddParamIfExist("l", ctx.Data["Language"])
|
||||
pager.AddParamString("l", language)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplUserCode)
|
||||
|
@@ -133,7 +133,7 @@ func Dashboard(ctx *context.Context) {
|
||||
ctx.Data["Feeds"] = feeds
|
||||
|
||||
pager := context.NewPagination(int(count), setting.UI.FeedPagingNum, page, 5)
|
||||
pager.AddParamIfExist("date", ctx.Data["Date"])
|
||||
pager.AddParamString("date", date)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplDashboard)
|
||||
@@ -329,10 +329,10 @@ func Milestones(ctx *context.Context) {
|
||||
ctx.Data["IsShowClosed"] = isShowClosed
|
||||
|
||||
pager := context.NewPagination(pagerCount, setting.UI.IssuePagingNum, page, 5)
|
||||
pager.AddParamIfExist("q", ctx.Data["Keyword"])
|
||||
pager.AddParamIfExist("repos", ctx.Data["RepoIDs"])
|
||||
pager.AddParamIfExist("sort", ctx.Data["SortType"])
|
||||
pager.AddParamIfExist("state", ctx.Data["State"])
|
||||
pager.AddParamString("q", keyword)
|
||||
pager.AddParamString("repos", reposQuery)
|
||||
pager.AddParamString("sort", sortType)
|
||||
pager.AddParamString("state", fmt.Sprint(ctx.Data["State"]))
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplMilestones)
|
||||
@@ -632,13 +632,11 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
|
||||
}
|
||||
|
||||
pager := context.NewPagination(shownIssues, setting.UI.IssuePagingNum, page, 5)
|
||||
pager.AddParamIfExist("q", ctx.Data["Keyword"])
|
||||
pager.AddParamIfExist("type", ctx.Data["ViewType"])
|
||||
pager.AddParamIfExist("sort", ctx.Data["SortType"])
|
||||
pager.AddParamIfExist("state", ctx.Data["State"])
|
||||
pager.AddParamIfExist("labels", ctx.Data["SelectLabels"])
|
||||
pager.AddParamIfExist("milestone", ctx.Data["MilestoneID"])
|
||||
pager.AddParamIfExist("assignee", ctx.Data["AssigneeID"])
|
||||
pager.AddParamString("q", keyword)
|
||||
pager.AddParamString("type", viewType)
|
||||
pager.AddParamString("sort", sortType)
|
||||
pager.AddParamString("state", fmt.Sprint(ctx.Data["State"]))
|
||||
pager.AddParamString("labels", selectedLabels)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplIssues)
|
||||
|
@@ -344,8 +344,8 @@ func NotificationSubscriptions(ctx *context.Context) {
|
||||
ctx.Redirect(fmt.Sprintf("/notifications/subscriptions?page=%d", pager.Paginater.Current()))
|
||||
return
|
||||
}
|
||||
pager.AddParamIfExist("sort", ctx.Data["SortType"])
|
||||
pager.AddParamIfExist("state", ctx.Data["State"])
|
||||
pager.AddParamString("sort", sortType)
|
||||
pager.AddParamString("state", state)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplNotificationSubscriptions)
|
||||
|
@@ -125,8 +125,8 @@ func ListPackages(ctx *context.Context) {
|
||||
}
|
||||
|
||||
pager := context.NewPagination(int(total), setting.UI.PackagesPagingNum, page, 5)
|
||||
pager.AddParamIfExist("q", ctx.Data["Query"])
|
||||
pager.AddParamIfExist("type", ctx.Data["PackageType"])
|
||||
pager.AddParamString("q", query)
|
||||
pager.AddParamString("type", packageType)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplPackagesList)
|
||||
|
@@ -324,12 +324,14 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
|
||||
|
||||
pager := context.NewPagination(total, pagingNum, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
pager.AddParamIfExist("tab", ctx.Data["TabName"])
|
||||
pager.AddParamString("tab", tab)
|
||||
if tab != "followers" && tab != "following" && tab != "activity" && tab != "projects" {
|
||||
pager.AddParamIfExist("language", ctx.Data["Language"])
|
||||
pager.AddParamString("language", language)
|
||||
}
|
||||
if tab == "activity" {
|
||||
pager.AddParamIfExist("date", ctx.Data["Date"])
|
||||
if ctx.Data["Date"] != nil {
|
||||
pager.AddParamString("date", fmt.Sprint(ctx.Data["Date"]))
|
||||
}
|
||||
}
|
||||
ctx.Data["Page"] = pager
|
||||
}
|
||||
|
Reference in New Issue
Block a user