diff options
author | caicandong <50507092+CaiCandong@users.noreply.github.com> | 2023-07-31 10:21:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-31 02:21:09 +0000 |
commit | 983167cf49cd64c7a1f28c39aff03e00dd387990 (patch) | |
tree | a83bc57f7d441c0027a58e7ac0e7855f5940ffb3 /routers/web | |
parent | ea385f5d39a286ec36f3735fc7c5211b141f6165 (diff) | |
download | gitea-983167cf49cd64c7a1f28c39aff03e00dd387990.tar.gz gitea-983167cf49cd64c7a1f28c39aff03e00dd387990.zip |
Fix pull request check list is limited (#26179)
In the original implementation, we can only get the first 30 records of
the commit status (the default paging size), if the commit status is
more than 30, it will lead to the bug #25990. I made the following two
changes.
- On the page, use the ` db.ListOptions{ListAll: true}` parameter
instead of `db.ListOptions{}`
- The `GetLatestCommitStatus` function makes a determination as to
whether or not a pager is being used.
fixed #25990
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/repo/commit.go | 2 | ||||
-rw-r--r-- | routers/web/repo/pull.go | 6 | ||||
-rw-r--r-- | routers/web/repo/view.go | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go index 5b32591b89..7513f9360b 100644 --- a/routers/web/repo/commit.go +++ b/routers/web/repo/commit.go @@ -349,7 +349,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{}) + statuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, commitID, db.ListOptions{ListAll: true}) if err != nil { log.Error("GetLatestCommitStatus: %v", err) } diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index a24ef43367..d76e90bf24 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -469,7 +469,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{}) + commitStatuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, sha, db.ListOptions{ListAll: true}) if err != nil { ctx.ServerError("GetLatestCommitStatus", err) return nil @@ -531,7 +531,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{}) + commitStatuses, _, err := git_model.GetLatestCommitStatus(ctx, repo.ID, sha, db.ListOptions{ListAll: true}) if err != nil { ctx.ServerError("GetLatestCommitStatus", err) return nil @@ -623,7 +623,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{}) + commitStatuses, _, err := git_model.GetLatestCommitStatus(ctx, repo.ID, sha, db.ListOptions{ListAll: true}) if err != nil { ctx.ServerError("GetLatestCommitStatus", err) return nil diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 221c1f4c4f..ae22bae9c1 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -842,7 +842,7 @@ func renderDirectoryFiles(ctx *context.Context, timeout time.Duration) git.Entri 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{}) + statuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, latestCommit.ID.String(), db.ListOptions{ListAll: true}) if err != nil { log.Error("GetLatestCommitStatus: %v", err) } |