From 08424648ae0e7db107d0a1d8b4454557cb9f275f Mon Sep 17 00:00:00 2001 From: John Olheiser <42128690+jolheiser@users.noreply.github.com> Date: Sat, 4 Jan 2020 20:39:14 -0600 Subject: [PATCH] Fix create bugs (#9606) Signed-off-by: jolheiser --- routers/repo/repo.go | 5 +++-- web_src/js/index.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/routers/repo/repo.go b/routers/repo/repo.go index d44812729..d6d91f084 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -180,6 +180,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) { return } + var repo *models.Repository var err error if form.RepoTemplate > 0 { opts := models.GenerateRepoOptions{ @@ -209,14 +210,14 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) { return } - repo, err := repo_service.GenerateRepository(ctx.User, ctxUser, templateRepo, opts) + repo, err = repo_service.GenerateRepository(ctx.User, ctxUser, templateRepo, opts) if err == nil { log.Trace("Repository generated [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name) ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name) return } } else { - repo, err := repo_service.CreateRepository(ctx.User, ctxUser, models.CreateRepoOptions{ + repo, err = repo_service.CreateRepository(ctx.User, ctxUser, models.CreateRepoOptions{ Name: form.RepoName, Description: form.Description, Gitignores: form.Gitignores, diff --git a/web_src/js/index.js b/web_src/js/index.js index 3751c6d9e..b8145fa43 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -2271,7 +2271,7 @@ function initTemplateSearch() { const checkTemplate = function () { const $templateUnits = $('#template_units'); const $nonTemplate = $('#non_template'); - if ($repoTemplate.val() !== '') { + if ($repoTemplate.val() !== '' && $repoTemplate.val() !== '0') { $templateUnits.show(); $nonTemplate.hide(); } else {