Skip to content

Commit f615c7c

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 de8127e commit f615c7c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

routers/web/repo/issue.go

+8
Original file line numberDiff line numberDiff line change
@@ -2726,7 +2726,15 @@ func UpdateIssueStatus(ctx *context.Context) {
27262726
ctx.ServerError("LoadRepositories", err)
27272727
return
27282728
}
2729+
if err := issues.LoadPullRequests(ctx); err != nil {
2730+
ctx.ServerError("LoadPullRequests", err)
2731+
return
2732+
}
2733+
27292734
for _, issue := range issues {
2735+
if issue.IsPull && issue.PullRequest.HasMerged {
2736+
continue
2737+
}
27302738
if issue.IsClosed != isClosed {
27312739
if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil {
27322740
if issues_model.IsErrDependenciesLeft(err) {

0 commit comments

Comments
 (0)