mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-30 19:08:37 +00:00 
			
		
		
		
	Avoid opening/closing PRs which are already merged (#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:  You can confirm this in: https://try.gitea.io/yp05327/testrepo/pulls/5
This commit is contained in:
		| @@ -2762,7 +2762,15 @@ func UpdateIssueStatus(ctx *context.Context) { | |||||||
| 		ctx.ServerError("LoadRepositories", err) | 		ctx.ServerError("LoadRepositories", err) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	if err := issues.LoadPullRequests(ctx); err != nil { | ||||||
|  | 		ctx.ServerError("LoadPullRequests", err) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	for _, issue := range issues { | 	for _, issue := range issues { | ||||||
|  | 		if issue.IsPull && issue.PullRequest.HasMerged { | ||||||
|  | 			continue | ||||||
|  | 		} | ||||||
| 		if issue.IsClosed != isClosed { | 		if issue.IsClosed != isClosed { | ||||||
| 			if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil { | 			if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil { | ||||||
| 				if issues_model.IsErrDependenciesLeft(err) { | 				if issues_model.IsErrDependenciesLeft(err) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user