Performance improvements for pull request list page (#29900)
This PR will avoid load pullrequest.Issue twice in pull request list page. It will reduce x times database queries for those WIP pull requests. Partially fix #29585 --------- Co-authored-by: Giteabot <teabot@gitea.io> (cherry picked from commit 62f8174aa2fae1481c7e17a6afcb731a5b178cd0) Conflicts: models/activities/notification_list.go moved to models/activities/notification.go
This commit is contained in:
parent
0f4614004e
commit
d92c2048b3
14 changed files with 86 additions and 50 deletions
|
@ -874,10 +874,11 @@ func EditIssue(ctx *context.APIContext) {
|
|||
}
|
||||
if form.State != nil {
|
||||
if issue.IsPull {
|
||||
if pr, err := issue.GetPullRequest(ctx); err != nil {
|
||||
if err := issue.LoadPullRequest(ctx); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "GetPullRequest", err)
|
||||
return
|
||||
} else if pr.HasMerged {
|
||||
}
|
||||
if issue.PullRequest.HasMerged {
|
||||
ctx.Error(http.StatusPreconditionFailed, "MergedPRState", "cannot change state of this pull request, it was already merged")
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue