Skip to content

Commit eeee873

Browse files
silverwindclaude
andcommitted
Remove unnecessary int() casts on NewPagination calls
Now that NewPagination is generic [T ~int | ~int64], callers can pass int64 values directly without narrowing to int first. Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
1 parent d6e9f05 commit eeee873

21 files changed

Lines changed: 29 additions & 29 deletions

File tree

routers/web/admin/emails.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func Emails(ctx *context.Context) {
9393
ctx.Data["Total"] = count
9494
ctx.Data["Emails"] = emails
9595

96-
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
96+
pager := context.NewPagination(count, opts.PageSize, opts.Page, 5)
9797
pager.AddParamFromRequest(ctx.Req)
9898
ctx.Data["Page"] = pager
9999

routers/web/admin/notice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func Notices(ctx *context.Context) {
3737

3838
ctx.Data["Total"] = total
3939

40-
ctx.Data["Page"] = context.NewPagination(int(total), setting.UI.Admin.NoticePagingNum, page, 5)
40+
ctx.Data["Page"] = context.NewPagination(total, setting.UI.Admin.NoticePagingNum, page, 5)
4141

4242
ctx.HTML(http.StatusOK, tplNotices)
4343
}

routers/web/admin/packages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func Packages(ctx *context.Context) {
7373
ctx.Data["TotalBlobSize"] = totalBlobSize - totalUnreferencedBlobSize
7474
ctx.Data["TotalUnreferencedBlobSize"] = totalUnreferencedBlobSize
7575

76-
pager := context.NewPagination(int(total), setting.UI.PackagesPagingNum, page, 5)
76+
pager := context.NewPagination(total, setting.UI.PackagesPagingNum, page, 5)
7777
pager.AddParamFromRequest(ctx.Req)
7878
ctx.Data["Page"] = pager
7979

routers/web/explore/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
137137
ctx.Data["Repos"] = repos
138138
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
139139

140-
pager := context.NewPagination(int(count), opts.PageSize, page, 5)
140+
pager := context.NewPagination(count, opts.PageSize, page, 5)
141141
pager.AddParamFromRequest(ctx.Req)
142142
ctx.Data["Page"] = pager
143143

routers/web/explore/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func RenderUserSearch(ctx *context.Context, opts user_model.SearchUserOptions, t
119119
ctx.Data["ShowUserEmail"] = setting.UI.ShowUserEmail
120120
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
121121

122-
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
122+
pager := context.NewPagination(count, opts.PageSize, opts.Page, 5)
123123
pager.AddParamFromRequest(ctx.Req)
124124
ctx.Data["Page"] = pager
125125

routers/web/org/home.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func home(ctx *context.Context, viewRepositories bool) {
141141
ctx.Data["Repos"] = repos
142142
ctx.Data["Total"] = count
143143

144-
pager := context.NewPagination(int(count), setting.UI.User.RepoPagingNum, page, 5)
144+
pager := context.NewPagination(count, setting.UI.User.RepoPagingNum, page, 5)
145145
pager.AddParamFromRequest(ctx.Req)
146146
ctx.Data["Page"] = pager
147147

routers/web/org/members.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func Members(ctx *context.Context) {
5656
return
5757
}
5858

59-
pager := context.NewPagination(int(total), setting.UI.MembersPagingNum, page, 5)
59+
pager := context.NewPagination(total, setting.UI.MembersPagingNum, page, 5)
6060
opts.ListOptions.Page = page
6161
opts.ListOptions.PageSize = setting.UI.MembersPagingNum
6262
members, membersIsPublic, err := organization.FindOrgMembers(ctx, opts)

routers/web/org/projects.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func Projects(ctx *context.Context) {
119119
numPages = (int(total) - 1/setting.UI.IssuePagingNum)
120120
}
121121

122-
pager := context.NewPagination(int(total), setting.UI.IssuePagingNum, page, numPages)
122+
pager := context.NewPagination(total, setting.UI.IssuePagingNum, page, numPages)
123123
pager.AddParamFromRequest(ctx.Req)
124124
ctx.Data["Page"] = pager
125125

routers/web/repo/actions/actions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func prepareWorkflowList(ctx *context.Context, workflows []WorkflowInfo) {
341341

342342
ctx.Data["StatusInfoList"] = actions_model.GetStatusInfoList(ctx, ctx.Locale)
343343

344-
pager := context.NewPagination(int(total), opts.PageSize, opts.Page, 5)
344+
pager := context.NewPagination(total, opts.PageSize, opts.Page, 5)
345345
pager.AddParamFromRequest(ctx.Req)
346346
ctx.Data["Page"] = pager
347347
ctx.Data["HasWorkflowsOrRuns"] = len(workflows) > 0 || len(runs) > 0

routers/web/repo/branch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func Branches(ctx *context.Context) {
8484
ctx.Data["CommitStatus"] = commitStatus
8585
ctx.Data["CommitStatuses"] = commitStatuses
8686
ctx.Data["DefaultBranchBranch"] = defaultBranch
87-
pager := context.NewPagination(int(branchesCount), pageSize, page, 5)
87+
pager := context.NewPagination(branchesCount, pageSize, page, 5)
8888
pager.AddParamFromRequest(ctx.Req)
8989
ctx.Data["Page"] = pager
9090
ctx.HTML(http.StatusOK, tplBranch)

0 commit comments

Comments
 (0)