diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index e51631a721..adf7e93eac 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -843,12 +843,19 @@ func NewIssue(ctx *context.Context) {
func NewIssueChooseTemplate(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.issues.new")
ctx.Data["PageIsIssueList"] = true
- ctx.Data["milestone"] = ctx.FormInt64("milestone")
issueTemplates := ctx.IssueTemplatesFromDefaultBranch()
- ctx.Data["NewIssueChooseTemplate"] = len(issueTemplates) > 0
ctx.Data["IssueTemplates"] = issueTemplates
+ if len(issueTemplates) == 0 {
+ // The "issues/new" and "issues/new/choose" share the same query parameters "project" and "milestone", if no template here, just redirect to the "issues/new" page with these parameters.
+ ctx.Redirect(fmt.Sprintf("%s/issues/new?%s", ctx.Repo.Repository.HTMLURL(), ctx.Req.URL.RawQuery), http.StatusSeeOther)
+ return
+ }
+
+ ctx.Data["milestone"] = ctx.FormInt64("milestone")
+ ctx.Data["project"] = ctx.FormInt64("project")
+
ctx.HTML(http.StatusOK, tplIssueChoose)
}
diff --git a/templates/repo/issue/choose.tmpl b/templates/repo/issue/choose.tmpl
index 0cec1ef63c..4a26e4f689 100644
--- a/templates/repo/issue/choose.tmpl
+++ b/templates/repo/issue/choose.tmpl
@@ -14,7 +14,7 @@
{{.About | RenderEmojiPlain}}