Skip to content

Commit

Permalink
Avoid opening/closing PRs which are already merged (go-gitea#25883) (g…
Browse files Browse the repository at this point in the history
…o-gitea#25903)

Backport go-gitea#25883 by @yp05327

We can select PRs to open/close them by one click, but we forgot to
check whether it is merged.
You can get an opening merged PR:

![image](https://github.com/go-gitea/gitea/assets/18380374/22c2e747-4bb9-4742-a9aa-ef39d5308bc5)

You can confirm this in:
https://try.gitea.io/yp05327/testrepo/pulls/5

Co-authored-by: yp05327 <[email protected]>
  • Loading branch information
GiteaBot and yp05327 authored Jul 17, 2023
1 parent 9369b38 commit 9159964
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2726,7 +2726,15 @@ func UpdateIssueStatus(ctx *context.Context) {
ctx.ServerError("LoadRepositories", err)
return
}
if err := issues.LoadPullRequests(ctx); err != nil {
ctx.ServerError("LoadPullRequests", err)
return
}

for _, issue := range issues {
if issue.IsPull && issue.PullRequest.HasMerged {
continue
}
if issue.IsClosed != isClosed {
if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil {
if issues_model.IsErrDependenciesLeft(err) {
Expand Down

0 comments on commit 9159964

Please sign in to comment.