]> source.dussan.org Git - gitea.git/commitdiff
Fix create bugs (#9606)
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>
Sun, 5 Jan 2020 02:39:14 +0000 (20:39 -0600)
committertechknowlogick <techknowlogick@gitea.io>
Sun, 5 Jan 2020 02:39:14 +0000 (21:39 -0500)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
routers/repo/repo.go
web_src/js/index.js

index d44812729fe4ef6518e3f80c642356d53b4750d8..d6d91f084341216a88f70252ecc34e34c47478bb 100644 (file)
@@ -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,
index 3751c6d9e46f21f020d89a56f1495a66890b1b9b..b8145fa439912be6ab90940a72ca87378544de4c 100644 (file)
@@ -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 {