mirror of https://github.com/go-gitea/gitea.git
fix delete pull head ref for DeleteIssue (#20032)
* fix delete pull head ref for DeleteIssue fix #19655 Signed-off-by: a1012112796 <1012112796@qq.com> * add different help message for delete pull request Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
e86f18a05a
commit
cc42c6488a
|
@ -1610,6 +1610,9 @@ pulls.auto_merge_canceled_schedule = The auto merge was canceled for this pull r
|
|||
pulls.auto_merge_newly_scheduled_comment = `scheduled this pull request to auto merge when all checks succeed %[1]s`
|
||||
pulls.auto_merge_canceled_schedule_comment = `canceled auto merging this pull request when all checks succeed %[1]s`
|
||||
|
||||
pulls.delete.title = Delete this pull request?
|
||||
pulls.delete.text = Do you really want to delete this pull request? (This will permanently remove all content. Consider closing it instead, if you intend to keep it archived)
|
||||
|
||||
milestones.new = New Milestone
|
||||
milestones.closed = Closed %s
|
||||
milestones.update_ago = Updated %s ago
|
||||
|
|
|
@ -878,6 +878,11 @@ func DeleteIssue(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if issue.IsPull {
|
||||
ctx.Redirect(fmt.Sprintf("%s/pulls", ctx.Repo.Repository.HTMLURL()), http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Redirect(fmt.Sprintf("%s/issues", ctx.Repo.Repository.HTMLURL()), http.StatusSeeOther)
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_m
|
|||
|
||||
// delete pull request related git data
|
||||
if issue.IsPull {
|
||||
if err := gitRepo.RemoveReference(fmt.Sprintf("%s%d", git.PullPrefix, issue.PullRequest.Index)); err != nil {
|
||||
if err := gitRepo.RemoveReference(fmt.Sprintf("%s%d/head", git.PullPrefix, issue.PullRequest.Index)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -660,11 +660,19 @@
|
|||
</button>
|
||||
<div class="ui basic modal" id="delete">
|
||||
<div class="ui icon header">
|
||||
{{if .Issue.IsPull}}
|
||||
{{.i18n.Tr "repo.pulls.delete.title"}}
|
||||
{{else}}
|
||||
{{.i18n.Tr "repo.issues.delete.title"}}
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="content center">
|
||||
<p>
|
||||
{{if .Issue.IsPull}}
|
||||
{{.i18n.Tr "repo.pulls.delete.text"}}
|
||||
{{else}}
|
||||
{{.i18n.Tr "repo.issues.delete.text"}}
|
||||
{{end}}
|
||||
</p>
|
||||
</div>
|
||||
<form action="{{.Issue.Link}}/delete" method="post">
|
||||
|
|
Loading…
Reference in New Issue