mirror of
https://github.com/go-gitea/gitea
synced 2025-01-24 20:37:44 +01:00
Add ref issue when creating pull request from issue
This commit is contained in:
parent
6b829f77a3
commit
0208f5bc4c
@ -1627,6 +1627,7 @@ issues.maybefixed = May be fixed by %s
|
||||
issues.create_branch_from_issue_success = Create branch %s from issue successfully
|
||||
issues.pr.completed = Completed
|
||||
issues.pr.conflicted = Merge conflicts
|
||||
issues.pr.not_exist_issue = Reference issue does not exist.
|
||||
issues.branch.latest = Latest commit %s
|
||||
issues.link.created = Created %s
|
||||
issues.num_participants = %d Participants
|
||||
|
@ -845,6 +845,21 @@ func CompareDiff(ctx *context.Context) {
|
||||
ctx.Data["AllowMaintainerEdit"] = false
|
||||
}
|
||||
|
||||
refIssueIndex := ctx.FormInt64("ref_issue_index")
|
||||
if refIssueIndex > 0 {
|
||||
refIssue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, refIssueIndex)
|
||||
if err != nil {
|
||||
ctx.Flash.Warning(ctx.Tr("repo.issues.pr.not_exist_issue"), true)
|
||||
} else {
|
||||
keyword := "Resolve"
|
||||
if len(setting.Repository.PullRequest.CloseKeywords) > 0 {
|
||||
keyword = setting.Repository.PullRequest.CloseKeywords[0]
|
||||
}
|
||||
ctx.Data["TitleQuery"] = fmt.Sprintf("%s %s", keyword, refIssue.Title)
|
||||
ctx.Data["BodyQuery"] = fmt.Sprintf("%s #%d", keyword, refIssueIndex)
|
||||
}
|
||||
}
|
||||
|
||||
ctx.HTML(http.StatusOK, tplCompare)
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="tw-right">
|
||||
<a class="ui button mini compact basic icon" href="{{$.Issue.Repo.Link}}/compare/{{$.Issue.Repo.DefaultBranch}}...{{.Branch.Repo.FullName}}:{{.Branch.Name}}">
|
||||
<a class="ui button mini compact basic icon" href="{{$.Issue.Repo.Link}}/compare/{{$.Issue.Repo.DefaultBranch}}...{{.Branch.Repo.FullName}}:{{.Branch.Name}}?ref_issue_index={{$.Issue.Index}}">
|
||||
{{svg "octicon-git-pull-request"}}
|
||||
</a>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user