summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-03-22 13:53:52 +0100
committerEarl Warren <contact@earl-warren.org>2024-03-26 19:04:27 +0100
commit196c8772a80e81c210be6fad09698f2ced4363d4 (patch)
tree91d40f93c40f4a212d9f5fa780c43b1a6e2b35f0 /routers
parentSmall refactors in anchors.js (#29947) (diff)
downloadforgejo-196c8772a80e81c210be6fad09698f2ced4363d4.tar.xz
forgejo-196c8772a80e81c210be6fad09698f2ced4363d4.zip
Use db.ListOptionsAll instead of db.ListOptions{ListAll: true} (#29995)
(cherry picked from commit f8ab9dafb7a173a35e9308f8f784735b0f822439) Conflicts: routers/web/repo/fork.go trivial context conflict, the file does not exist in Forgejo
Diffstat (limited to 'routers')
-rw-r--r--routers/web/admin/users.go8
-rw-r--r--routers/web/repo/commit.go2
-rw-r--r--routers/web/repo/compare.go12
-rw-r--r--routers/web/repo/pull.go6
-rw-r--r--routers/web/repo/release.go2
-rw-r--r--routers/web/repo/repo.go8
-rw-r--r--routers/web/repo/view.go2
7 files changed, 14 insertions, 26 deletions
diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go
index 6dfcfc3d9a..b93668c5a2 100644
--- a/routers/web/admin/users.go
+++ b/routers/web/admin/users.go
@@ -275,9 +275,7 @@ func ViewUser(ctx *context.Context) {
}
repos, count, err := repo_model.SearchRepository(ctx, &repo_model.SearchRepoOptions{
- ListOptions: db.ListOptions{
- ListAll: true,
- },
+ ListOptions: db.ListOptionsAll,
OwnerID: u.ID,
OrderBy: db.SearchOrderByAlphabetically,
Private: true,
@@ -300,9 +298,7 @@ func ViewUser(ctx *context.Context) {
ctx.Data["EmailsTotal"] = len(emails)
orgs, err := db.Find[org_model.Organization](ctx, org_model.FindOrgOptions{
- ListOptions: db.ListOptions{
- ListAll: true,
- },
+ ListOptions: db.ListOptionsAll,
UserID: u.ID,
IncludePrivate: true,
})
diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go
index 0c585a93b8..718454e063 100644
--- a/routers/web/repo/commit.go
+++ b/routers/web/repo/commit.go
@@ -367,7 +367,7 @@ func Diff(ctx *context.Context) {
ctx.Data["Commit"] = commit
ctx.Data["Diff"] = diff
- statuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, commitID, db.ListOptions{ListAll: true})
+ statuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, commitID, db.ListOptionsAll)
if err != nil {
log.Error("GetLatestCommitStatus: %v", err)
}
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go
index 7b5243e6b7..cfb0e859bd 100644
--- a/routers/web/repo/compare.go
+++ b/routers/web/repo/compare.go
@@ -697,10 +697,8 @@ func getBranchesAndTagsForRepo(ctx gocontext.Context, repo *repo_model.Repositor
defer gitRepo.Close()
branches, err = git_model.FindBranchNames(ctx, git_model.FindBranchOptions{
- RepoID: repo.ID,
- ListOptions: db.ListOptions{
- ListAll: true,
- },
+ RepoID: repo.ID,
+ ListOptions: db.ListOptionsAll,
IsDeletedBranch: optional.Some(false),
})
if err != nil {
@@ -754,10 +752,8 @@ func CompareDiff(ctx *context.Context) {
}
headBranches, err := git_model.FindBranchNames(ctx, git_model.FindBranchOptions{
- RepoID: ci.HeadRepo.ID,
- ListOptions: db.ListOptions{
- ListAll: true,
- },
+ RepoID: ci.HeadRepo.ID,
+ ListOptions: db.ListOptionsAll,
IsDeletedBranch: optional.Some(false),
})
if err != nil {
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index 8727f3d1e3..c6c6142534 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -505,7 +505,7 @@ func PrepareMergedViewPullInfo(ctx *context.Context, issue *issues_model.Issue)
if len(compareInfo.Commits) != 0 {
sha := compareInfo.Commits[0].ID.String()
- commitStatuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, sha, db.ListOptions{ListAll: true})
+ commitStatuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, sha, db.ListOptionsAll)
if err != nil {
ctx.ServerError("GetLatestCommitStatus", err)
return nil
@@ -567,7 +567,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
ctx.ServerError(fmt.Sprintf("GetRefCommitID(%s)", pull.GetGitRefName()), err)
return nil
}
- commitStatuses, _, err := git_model.GetLatestCommitStatus(ctx, repo.ID, sha, db.ListOptions{ListAll: true})
+ commitStatuses, _, err := git_model.GetLatestCommitStatus(ctx, repo.ID, sha, db.ListOptionsAll)
if err != nil {
ctx.ServerError("GetLatestCommitStatus", err)
return nil
@@ -659,7 +659,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
return nil
}
- commitStatuses, _, err := git_model.GetLatestCommitStatus(ctx, repo.ID, sha, db.ListOptions{ListAll: true})
+ commitStatuses, _, err := git_model.GetLatestCommitStatus(ctx, repo.ID, sha, db.ListOptionsAll)
if err != nil {
ctx.ServerError("GetLatestCommitStatus", err)
return nil
diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go
index 95447a8f54..38bb1305fb 100644
--- a/routers/web/repo/release.go
+++ b/routers/web/repo/release.go
@@ -136,7 +136,7 @@ func getReleaseInfos(ctx *context.Context, opts *repo_model.FindReleasesOptions)
}
if canReadActions {
- statuses, _, err := git_model.GetLatestCommitStatus(ctx, r.Repo.ID, r.Sha1, db.ListOptions{ListAll: true})
+ statuses, _, err := git_model.GetLatestCommitStatus(ctx, r.Repo.ID, r.Sha1, db.ListOptionsAll)
if err != nil {
return nil, err
}
diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go
index bda78b0edc..b2458a561a 100644
--- a/routers/web/repo/repo.go
+++ b/routers/web/repo/repo.go
@@ -684,9 +684,7 @@ func GetBranchesList(ctx *context.Context) {
branchOpts := git_model.FindBranchOptions{
RepoID: ctx.Repo.Repository.ID,
IsDeletedBranch: optional.Some(false),
- ListOptions: db.ListOptions{
- ListAll: true,
- },
+ ListOptions: db.ListOptionsAll,
}
branches, err := git_model.FindBranchNames(ctx, branchOpts)
if err != nil {
@@ -719,9 +717,7 @@ func PrepareBranchList(ctx *context.Context) {
branchOpts := git_model.FindBranchOptions{
RepoID: ctx.Repo.Repository.ID,
IsDeletedBranch: optional.Some(false),
- ListOptions: db.ListOptions{
- ListAll: true,
- },
+ ListOptions: db.ListOptionsAll,
}
brs, err := git_model.FindBranchNames(ctx, branchOpts)
if err != nil {
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index 8ddfd92aa1..e4d7179f63 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -364,7 +364,7 @@ func loadLatestCommitData(ctx *context.Context, latestCommit *git.Commit) bool {
ctx.Data["LatestCommitVerification"] = verification
ctx.Data["LatestCommitUser"] = user_model.ValidateCommitWithEmail(ctx, latestCommit)
- statuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, latestCommit.ID.String(), db.ListOptions{ListAll: true})
+ statuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, latestCommit.ID.String(), db.ListOptionsAll)
if err != nil {
log.Error("GetLatestCommitStatus: %v", err)
}