Skip to content

Commit b4ee3a9

Browse files
yp05327GiteaBot
authored andcommitted
Avoid opening/closing PRs which are already merged (go-gitea#25883)
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
1 parent ee87b4e commit b4ee3a9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

routers/web/repo/issue.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,7 +2653,15 @@ func UpdateIssueStatus(ctx *context.Context) {
26532653
ctx.ServerError("LoadRepositories", err)
26542654
return
26552655
}
2656+
if err := issues.LoadPullRequests(ctx); err != nil {
2657+
ctx.ServerError("LoadPullRequests", err)
2658+
return
2659+
}
2660+
26562661
for _, issue := range issues {
2662+
if issue.IsPull && issue.PullRequest.HasMerged {
2663+
continue
2664+
}
26572665
if issue.IsClosed != isClosed {
26582666
if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil {
26592667
if issues_model.IsErrDependenciesLeft(err) {

0 commit comments

Comments
 (0)