0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-25 03:52:59 +01:00

Fix create bugs (#9606)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
John Olheiser 2020-01-04 20:39:14 -06:00 committed by techknowlogick
parent 03d59bcd1d
commit 08424648ae
2 changed files with 4 additions and 3 deletions

View file

@ -180,6 +180,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
return return
} }
var repo *models.Repository
var err error var err error
if form.RepoTemplate > 0 { if form.RepoTemplate > 0 {
opts := models.GenerateRepoOptions{ opts := models.GenerateRepoOptions{
@ -209,14 +210,14 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
return return
} }
repo, err := repo_service.GenerateRepository(ctx.User, ctxUser, templateRepo, opts) repo, err = repo_service.GenerateRepository(ctx.User, ctxUser, templateRepo, opts)
if err == nil { if err == nil {
log.Trace("Repository generated [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name) log.Trace("Repository generated [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name) ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
return return
} }
} else { } else {
repo, err := repo_service.CreateRepository(ctx.User, ctxUser, models.CreateRepoOptions{ repo, err = repo_service.CreateRepository(ctx.User, ctxUser, models.CreateRepoOptions{
Name: form.RepoName, Name: form.RepoName,
Description: form.Description, Description: form.Description,
Gitignores: form.Gitignores, Gitignores: form.Gitignores,

View file

@ -2271,7 +2271,7 @@ function initTemplateSearch() {
const checkTemplate = function () { const checkTemplate = function () {
const $templateUnits = $('#template_units'); const $templateUnits = $('#template_units');
const $nonTemplate = $('#non_template'); const $nonTemplate = $('#non_template');
if ($repoTemplate.val() !== '') { if ($repoTemplate.val() !== '' && $repoTemplate.val() !== '0') {
$templateUnits.show(); $templateUnits.show();
$nonTemplate.hide(); $nonTemplate.hide();
} else { } else {