mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-31 22:38:58 +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: ![grafik](https://github.com/go-gitea/gitea/assets/47871822/01dc2b3d-d56a-4053-b2fc-138725d7633a) --------- Co-authored-by: Denys Konovalov <kontakt@denyskon.de> Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
parent
571822b6ec
commit
80e564087d
2 changed files with 13 additions and 1 deletions
|
@ -844,6 +844,7 @@ func CompareDiff(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.Data["IsProjectsEnabled"] = ctx.Repo.CanWrite(unit.TypeProjects)
|
||||||
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
|
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
|
||||||
upload.AddUploadContext(ctx, "comment")
|
upload.AddUploadContext(ctx, "comment")
|
||||||
|
|
||||||
|
|
|
@ -1371,7 +1371,7 @@ func CompareAndPullRequestPost(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
labelIDs, assigneeIDs, milestoneID, _ := ValidateRepoMetas(ctx, *form, true)
|
labelIDs, assigneeIDs, milestoneID, projectID := ValidateRepoMetas(ctx, *form, true)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1449,6 +1449,17 @@ func CompareAndPullRequestPost(ctx *context.Context) {
|
||||||
return
|
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)
|
log.Trace("Pull request created: %d/%d", repo.ID, pullIssue.ID)
|
||||||
ctx.JSONRedirect(pullIssue.Link())
|
ctx.JSONRedirect(pullIssue.Link())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue