mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	Backport #28227 by @denyskon When creating a pull request, allow directly assigning it to a project, as it is already possible for issues. After:  --------- Co-authored-by: Denys Konovalov <kontakt@denyskon.de> Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
		| @@ -1371,7 +1371,7 @@ func CompareAndPullRequestPost(ctx *context.Context) { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	labelIDs, assigneeIDs, milestoneID, _ := ValidateRepoMetas(ctx, *form, true) | ||||
| 	labelIDs, assigneeIDs, milestoneID, projectID := ValidateRepoMetas(ctx, *form, true) | ||||
| 	if ctx.Written() { | ||||
| 		return | ||||
| 	} | ||||
| @@ -1449,6 +1449,17 @@ func CompareAndPullRequestPost(ctx *context.Context) { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	if projectID > 0 { | ||||
| 		if !ctx.Repo.CanWrite(unit.TypeProjects) { | ||||
| 			ctx.Error(http.StatusBadRequest, "user hasn't the permission to write to projects") | ||||
| 			return | ||||
| 		} | ||||
| 		if err := issues_model.ChangeProjectAssign(pullIssue, ctx.Doer, projectID); err != nil { | ||||
| 			ctx.ServerError("ChangeProjectAssign", err) | ||||
| 			return | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	log.Trace("Pull request created: %d/%d", repo.ID, pullIssue.ID) | ||||
| 	ctx.JSONRedirect(pullIssue.Link()) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user