1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Auto expand "New PR" form (#33971)

Follow GitHub's behavior: use `?expand=1` to expand the "New PR" form
This commit is contained in:
wxiaoguang
2025-03-24 22:28:02 +08:00
committed by GitHub
parent 25b6f38865
commit b1e326d09e
9 changed files with 62 additions and 41 deletions

View File

@@ -1269,6 +1269,21 @@ func stopTimerIfAvailable(ctx *context.Context, user *user_model.User, issue *is
return nil
}
func PullsNewRedirect(ctx *context.Context) {
branch := ctx.PathParam("*")
redirectRepo := ctx.Repo.Repository
repo := ctx.Repo.Repository
if repo.IsFork {
if err := repo.GetBaseRepo(ctx); err != nil {
ctx.ServerError("GetBaseRepo", err)
return
}
redirectRepo = repo.BaseRepo
branch = fmt.Sprintf("%s:%s", repo.OwnerName, branch)
}
ctx.Redirect(fmt.Sprintf("%s/compare/%s...%s?expand=1", redirectRepo.Link(), util.PathEscapeSegments(redirectRepo.DefaultBranch), util.PathEscapeSegments(branch)))
}
// CompareAndPullRequestPost response for creating pull request
func CompareAndPullRequestPost(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.CreateIssueForm)