diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 157565539c..c19788bf7d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -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 diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index e6a04782e5..91f69c3c25 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -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) } diff --git a/templates/repo/issue/view_content/sidebar_development.tmpl b/templates/repo/issue/view_content/sidebar_development.tmpl index dd3bc6b2db..5b451aa989 100644 --- a/templates/repo/issue/view_content/sidebar_development.tmpl +++ b/templates/repo/issue/view_content/sidebar_development.tmpl @@ -33,7 +33,7 @@
- + {{svg "octicon-git-pull-request"}}