Skip to content

Commit 6f5f0be

Browse files
GiteaBotendo0911engineerwxiaoguang
authored
Support title and body query parameters for new PRs (go-gitea#34537) (go-gitea#34752)
Backport go-gitea#34537 by endo0911engineer Co-authored-by: endo0911engineer <161911062+endo0911engineer@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent 23d2d22 commit 6f5f0be

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

routers/web/repo/compare.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,13 @@ func PrepareCompareDiff(
574574

575575
ctx.Data["CommitRepoLink"] = ci.HeadRepo.Link()
576576
ctx.Data["AfterCommitID"] = headCommitID
577-
ctx.Data["ExpandNewPrForm"] = ctx.FormBool("expand")
577+
578+
// follow GitHub's behavior: autofill the form and expand
579+
newPrFormTitle := ctx.FormTrim("title")
580+
newPrFormBody := ctx.FormTrim("body")
581+
ctx.Data["ExpandNewPrForm"] = ctx.FormBool("expand") || ctx.FormBool("quick_pull") || newPrFormTitle != "" || newPrFormBody != ""
582+
ctx.Data["TitleQuery"] = newPrFormTitle
583+
ctx.Data["BodyQuery"] = newPrFormBody
578584

579585
if (headCommitID == ci.CompareInfo.MergeBase && !ci.DirectComparison) ||
580586
headCommitID == ci.CompareInfo.BaseCommitID {

0 commit comments

Comments
 (0)