]> source.dussan.org Git - gitea.git/commitdiff
api: able to create repo and fix #726
authorUnknwon <joe2010xtmf@163.com>
Sat, 13 Dec 2014 01:30:32 +0000 (20:30 -0500)
committerUnknwon <joe2010xtmf@163.com>
Sat, 13 Dec 2014 01:30:32 +0000 (20:30 -0500)
- POST /user/repos
- POST /org/:org/repos

14 files changed:
cmd/web.go
conf/locale/locale_de-DE.ini
gogs.go
models/org.go
modules/auth/repo_form.go
modules/middleware/org.go
modules/middleware/repo.go
routers/api/v1/repo.go
routers/api/v1/repo_hooks.go
routers/api/v1/user.go
routers/repo/repo.go
routers/repo/setting.go
templates/.VERSION
templates/repo/create.tmpl

index 6f1319a4e569dc967e620789f1824bc30f30ddf0..df9a380c115315afec4166f1c2c981d6fbfeebc3 100644 (file)
@@ -26,6 +26,8 @@ import (
        "github.com/macaron-contrib/session"
        "github.com/macaron-contrib/toolbox"
 
+       api "github.com/gogits/go-gogs-client"
+
        "github.com/gogits/gogs/models"
        "github.com/gogits/gogs/modules/auth"
        "github.com/gogits/gogs/modules/auth/apiv1"
@@ -66,7 +68,7 @@ func checkVersion() {
 
        // Check dependency version.
        macaronVer := git.MustParseVersion(strings.Join(strings.Split(macaron.Version(), ".")[:3], "."))
-       if macaronVer.LessThan(git.MustParseVersion("0.4.2")) {
+       if macaronVer.LessThan(git.MustParseVersion("0.4.7")) {
                log.Fatal(4, "Package macaron version is too old, did you forget to update?(github.com/Unknwon/macaron)")
        }
        i18nVer := git.MustParseVersion(i18n.Version())
@@ -200,14 +202,15 @@ func runWeb(*cli.Context) {
                        })
 
                        // Repositories.
-                       m.Get("/user/repos", middleware.ApiReqToken(), v1.ListMyRepos)
+                       m.Combo("/user/repos", middleware.ApiReqToken()).Get(v1.ListMyRepos).Post(bind(api.CreateRepoOption{}), v1.CreateRepo)
+                       m.Post("/org/:org/repos", middleware.ApiReqToken(), bind(api.CreateRepoOption{}), v1.CreateOrgRepo)
                        m.Group("/repos", func() {
                                m.Get("/search", v1.SearchRepos)
-                               m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.Migrate)
+                               m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.MigrateRepo)
 
                                m.Group("/:username/:reponame", func() {
-                                       m.Combo("/hooks").Get(v1.ListRepoHooks).Post(bind(v1.CreateRepoHookForm{}), v1.CreateRepoHook)
-                                       m.Patch("/hooks/:id:int", bind(v1.EditRepoHookForm{}), v1.EditRepoHook)
+                                       m.Combo("/hooks").Get(v1.ListRepoHooks).Post(bind(api.CreateHookOption{}), v1.CreateRepoHook)
+                                       m.Patch("/hooks/:id:int", bind(api.EditHookOption{}), v1.EditRepoHook)
                                        m.Get("/raw/*", middleware.RepoRef(), v1.GetRepoRawFile)
                                }, middleware.ApiRepoAssignment(), middleware.ApiReqToken())
                        })
index b40f2da5f92e52c7b1d9164027529be0ed184eac..6a16aa21577bd972563dae270905c6b4106a6416 100755 (executable)
@@ -208,7 +208,7 @@ enable_custom_avatar_helper=Aktiviere dies, um deinen Avatar nicht von Gravatar
 choose_new_avatar=Neuen Avatar auswählen\r
 update_avatar=Avatar-Einstellung aktualisieren\r
 uploaded_avatar_not_a_image=Die hochgeladene Datei ist kein Bild.\r
-no_custom_avatar_available=No custom avatar available, cannot enable it.\r
+no_custom_avatar_available=Kein benutzerdefinierter Avatar verfügbar, Aktivierung ist nicht möglich.\r
 update_avatar_success=Deine Avatar-Einstellung wurde aktualisiert.\r
 \r
 change_password=Passwort ändern\r
@@ -377,6 +377,30 @@ diff.stats_desc=<strong> %d geänderte Dateien</strong> mit <strong>%d neuen Zei
 diff.bin=BIN\r
 diff.view_file=Datei anzeigen\r
 \r
+release.releases=Releases\r
+release.new_release=Neues Release\r
+release.draft=Entwurf\r
+release.prerelease=Pre-Release\r
+release.stable=Endversion\r
+release.edit=bearbeiten\r
+release.ahead=<strong>%d</strong> Commits zu %s seit diesem Release\r
+release.source_code=Quelltext\r
+release.tag_name=Tag-Name\r
+release.target=Ziel\r
+release.tag_helper=Wähle ein neues Tag oder erstelle ein Tag beim Veröffentlichen.\r
+release.release_title=Release-Titel\r
+release.content_with_md=Inhalt mit <a href="%s">Markdown</a>\r
+release.write=Schreiben\r
+release.preview=Vorschau\r
+release.content_placeholder=Schreibe hier etwas\r
+release.loading=Laden…\r
+release.prerelease_desc=Dies ist eine Pre-Release-Version\r
+release.prerelease_helper=Wir möchten darauf hinweisen, dass dieses Release nicht für den produktiven Einsatz gedacht ist.\r
+release.publish=Release veröffentlichen\r
+release.save_draft=Entwurf speichern\r
+release.edit_release=Release bearbeiten\r
+release.tag_name_already_exist=Ein Release mit diesem Tag existiert bereits.\r
+\r
 [org]\r
 org_name_holder=Name der Organisation\r
 org_name_helper=Gute Namen von Organisationen sind kurz und einprägsam.\r
@@ -476,8 +500,8 @@ dashboard.delete_inactivate_accounts=inaktive Konten löschen
 dashboard.delete_inactivate_accounts_success=Alle inaktiven Konten wurden erfolgreich gelöscht.\r
 dashboard.delete_repo_archives=Alle Repository-Archive löschen\r
 dashboard.delete_repo_archives_success=Alle Repositoriy-Archive wurden gelöscht.\r
-dashboard.git_gc_repos=Führe Garbage Collection auf Repositorys aus\r
-dashboard.git_gc_repos_success=Garbage Collection wurde auf allen Repositorys erfolgreich ausgeführt.\r
+dashboard.git_gc_repos=Führe Garbage Collection auf Repositories aus\r
+dashboard.git_gc_repos_success=Garbage Collection wurde auf allen Repositories erfolgreich ausgeführt.\r
 dashboard.server_uptime=Server-Uptime\r
 dashboard.current_goroutine=Aktuelle Goroutines\r
 dashboard.current_memory_usage=Aktuelle Speichernutzung\r
diff --git a/gogs.go b/gogs.go
index de76ca722b94d689af4cef66d18c51e8573516a0..88cc03a876398a0fa554b92eb747ec6685312876 100644 (file)
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
        "github.com/gogits/gogs/modules/setting"
 )
 
-const APP_VER = "0.5.8.1211 Beta"
+const APP_VER = "0.5.8.1212 Beta"
 
 func init() {
        runtime.GOMAXPROCS(runtime.NumCPU())
index 41611f8116bc6ff9311b922d395aa5c128d8ece4..5431a111c3dd9c6fd2acf4fc8b9073bfc5dbc0f6 100644 (file)
@@ -25,8 +25,8 @@ var (
        ErrLastOrgOwner     = errors.New("The user to remove is the last member in owner team")
 )
 
-// IsOrgOwner returns true if given user is in the owner team.
-func (org *User) IsOrgOwner(uid int64) bool {
+// IsOwnedBy returns true if given user is in the owner team.
+func (org *User) IsOwnedBy(uid int64) bool {
        return IsOrganizationOwner(org.Id, uid)
 }
 
@@ -170,6 +170,24 @@ func CreateOrganization(org, owner *User) (*User, error) {
        return org, sess.Commit()
 }
 
+// GetOrgByName returns organization by given name.
+func GetOrgByName(name string) (*User, error) {
+       if len(name) == 0 {
+               return nil, ErrOrgNotExist
+       }
+       u := &User{
+               LowerName: strings.ToLower(name),
+               Type:      ORGANIZATION,
+       }
+       has, err := x.Get(u)
+       if err != nil {
+               return nil, err
+       } else if !has {
+               return nil, ErrOrgNotExist
+       }
+       return u, nil
+}
+
 // CountOrganizations returns number of organizations.
 func CountOrganizations() int64 {
        count, _ := x.Where("type=1").Count(new(User))
index 41c0217a9343fc0f21fe87a9f4a986124cb94279..36e62f04fb0a35aa7b49af81755a5131230d62d1 100644 (file)
@@ -21,9 +21,9 @@ type CreateRepoForm struct {
        RepoName    string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
        Private     bool   `form:"private"`
        Description string `form:"desc" binding:"MaxSize(255)"`
+       AutoInit    bool   `form:"auto_init"`
        Gitignore   string `form:"gitignore"`
        License     string `form:"license"`
-       InitReadme  bool   `form:"init_readme"`
 }
 
 func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
index be102989911502d29328c27bea895c90a8ae58db..e687258617ff9a96afbdf0e14214b99ba986a192 100644 (file)
@@ -48,7 +48,7 @@ func OrgAssignment(redirect bool, args ...bool) macaron.Handler {
                ctx.Data["Org"] = org
 
                if ctx.IsSigned {
-                       ctx.Org.IsOwner = org.IsOrgOwner(ctx.User.Id)
+                       ctx.Org.IsOwner = org.IsOwnedBy(ctx.User.Id)
                        if ctx.Org.IsOwner {
                                ctx.Org.IsMember = true
                                ctx.Org.IsAdminTeam = true
index 8b0f0c59f7fabd7b39dd60cdcce5610b5573a1ef..171619492571991873e9e533221dcc413b326ec9 100644 (file)
@@ -55,7 +55,7 @@ func ApiRepoAssignment() macaron.Handler {
                ctx.Repo.Owner = u
 
                // Organization owner team members are true owners as well.
-               if ctx.IsSigned && ctx.Repo.Owner.IsOrganization() && ctx.Repo.Owner.IsOrgOwner(ctx.User.Id) {
+               if ctx.IsSigned && ctx.Repo.Owner.IsOrganization() && ctx.Repo.Owner.IsOwnedBy(ctx.User.Id) {
                        ctx.Repo.IsTrueOwner = true
                }
 
@@ -280,7 +280,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
                ctx.Repo.Owner = u
 
                // Organization owner team members are true owners as well.
-               if ctx.IsSigned && ctx.Repo.Owner.IsOrganization() && ctx.Repo.Owner.IsOrgOwner(ctx.User.Id) {
+               if ctx.IsSigned && ctx.Repo.Owner.IsOrganization() && ctx.Repo.Owner.IsOwnedBy(ctx.User.Id) {
                        ctx.Repo.IsTrueOwner = true
                }
 
index 33e3b05a4b997ebc6e58eaacb564a609696fa975..6f237231643203328150d70185e1236b3a2ac1a5 100644 (file)
@@ -21,6 +21,26 @@ import (
        "github.com/gogits/gogs/modules/setting"
 )
 
+// ToApiRepository converts repository to API format.
+func ToApiRepository(owner *models.User, repo *models.Repository, permission api.Permission) *api.Repository {
+       sshUrlFmt := "%s@%s:%s/%s.git"
+       if setting.SshPort != 22 {
+               sshUrlFmt = "ssh://%s@%s:%d/%s/%s.git"
+       }
+       htmlUrl := setting.AppUrl + owner.Name + "/" + repo.Name
+       return &api.Repository{
+               Id:          repo.Id,
+               Owner:       *ToApiUser(owner),
+               FullName:    owner.Name + "/" + repo.Name,
+               Private:     repo.IsPrivate,
+               Fork:        repo.IsFork,
+               HtmlUrl:     htmlUrl,
+               SshUrl:      fmt.Sprintf(sshUrlFmt, setting.RunUser, setting.Domain, owner.LowerName, repo.LowerName),
+               CloneUrl:    htmlUrl + ".git",
+               Permissions: permission,
+       }
+}
+
 func SearchRepos(ctx *middleware.Context) {
        opt := models.SearchOption{
                Keyword: path.Base(ctx.Query("q")),
@@ -44,7 +64,7 @@ func SearchRepos(ctx *middleware.Context) {
                                })
                                return
                        }
-                       if u.IsOrganization() && u.IsOrgOwner(ctx.User.Id) {
+                       if u.IsOrganization() && u.IsOwnedBy(ctx.User.Id) {
                                opt.Private = true
                        }
                        // FIXME: how about collaborators?
@@ -75,13 +95,66 @@ func SearchRepos(ctx *middleware.Context) {
                }
        }
 
-       ctx.Render.JSON(200, map[string]interface{}{
+       ctx.JSON(200, map[string]interface{}{
                "ok":   true,
                "data": results,
        })
 }
 
-func Migrate(ctx *middleware.Context, form auth.MigrateRepoForm) {
+func createRepo(ctx *middleware.Context, owner *models.User, opt api.CreateRepoOption) {
+       repo, err := models.CreateRepository(owner, opt.Name, opt.Description,
+               opt.Gitignore, opt.License, opt.Private, false, opt.AutoInit)
+       if err != nil {
+               if err == models.ErrRepoAlreadyExist ||
+                       err == models.ErrRepoNameIllegal {
+                       ctx.JSON(422, &base.ApiJsonErr{err.Error(), base.DOC_URL})
+               } else {
+                       log.Error(4, "CreateRepository: %v", err)
+                       if repo != nil {
+                               if err = models.DeleteRepository(ctx.User.Id, repo.Id, ctx.User.Name); err != nil {
+                                       log.Error(4, "DeleteRepository: %v", err)
+                               }
+                       }
+                       ctx.Error(500)
+               }
+               return
+       }
+
+       ctx.JSON(200, ToApiRepository(owner, repo, api.Permission{true, true, true}))
+}
+
+// POST /user/repos
+// https://developer.github.com/v3/repos/#create
+func CreateRepo(ctx *middleware.Context, opt api.CreateRepoOption) {
+       // Shouldn't reach this condition, but just in case.
+       if ctx.User.IsOrganization() {
+               ctx.JSON(422, "not allowed creating repository for organization")
+               return
+       }
+       createRepo(ctx, ctx.User, opt)
+}
+
+// POST /orgs/:org/repos
+// https://developer.github.com/v3/repos/#create
+func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) {
+       org, err := models.GetOrgByName(ctx.Params(":org"))
+       if err != nil {
+               if err == models.ErrUserNotExist {
+                       ctx.Error(404)
+               } else {
+                       ctx.Error(500)
+               }
+               return
+       }
+
+       if !org.IsOwnedBy(ctx.User.Id) {
+               ctx.Error(403)
+               return
+       }
+       createRepo(ctx, org, opt)
+}
+
+func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
        u, err := models.GetUserByName(ctx.Query("username"))
        if err != nil {
                ctx.JSON(500, map[string]interface{}{
@@ -103,17 +176,15 @@ func Migrate(ctx *middleware.Context, form auth.MigrateRepoForm) {
        if form.Uid != u.Id {
                org, err := models.GetUserById(form.Uid)
                if err != nil {
-                       ctx.JSON(500, map[string]interface{}{
-                               "ok":    false,
-                               "error": err.Error(),
-                       })
+                       log.Error(4, "GetUserById: %v", err)
+                       ctx.Error(500)
                        return
                }
                ctxUser = org
        }
 
        if ctx.HasError() {
-               ctx.JSON(500, map[string]interface{}{
+               ctx.JSON(422, map[string]interface{}{
                        "ok":    false,
                        "error": ctx.GetErrMsg(),
                })
@@ -122,7 +193,7 @@ func Migrate(ctx *middleware.Context, form auth.MigrateRepoForm) {
 
        if ctxUser.IsOrganization() {
                // Check ownership of organization.
-               if !ctxUser.IsOrgOwner(u.Id) {
+               if !ctxUser.IsOwnedBy(u.Id) {
                        ctx.JSON(403, map[string]interface{}{
                                "ok":    false,
                                "error": "given user is not owner of organization",
@@ -173,29 +244,9 @@ func ListMyRepos(ctx *middleware.Context) {
                return
        }
 
-       sshUrlFmt := "%s@%s:%s/%s.git"
-       if setting.SshPort != 22 {
-               sshUrlFmt = "ssh://%s@%s:%d/%s/%s.git"
-       }
-
        repos := make([]*api.Repository, numOwnRepos+len(collaRepos))
-       // FIXME: make only one loop
        for i := range ownRepos {
-               repos[i] = &api.Repository{
-                       Id: ownRepos[i].Id,
-                       Owner: api.User{
-                               Id:        ctx.User.Id,
-                               UserName:  ctx.User.Name,
-                               AvatarUrl: string(setting.Protocol) + ctx.User.AvatarLink(),
-                       },
-                       FullName:    ctx.User.Name + "/" + ownRepos[i].Name,
-                       Private:     ownRepos[i].IsPrivate,
-                       Fork:        ownRepos[i].IsFork,
-                       HtmlUrl:     setting.AppUrl + ctx.User.Name + "/" + ownRepos[i].Name,
-                       SshUrl:      fmt.Sprintf(sshUrlFmt, setting.RunUser, setting.Domain, ctx.User.LowerName, ownRepos[i].LowerName),
-                       Permissions: api.Permission{true, true, true},
-               }
-               repos[i].CloneUrl = repos[i].HtmlUrl + ".git"
+               repos[i] = ToApiRepository(ctx.User, ownRepos[i], api.Permission{true, true, true})
        }
        for i := range collaRepos {
                if err = collaRepos[i].GetOwner(); err != nil {
@@ -203,24 +254,10 @@ func ListMyRepos(ctx *middleware.Context) {
                        return
                }
                j := i + numOwnRepos
-               repos[j] = &api.Repository{
-                       Id: collaRepos[i].Id,
-                       Owner: api.User{
-                               Id:        collaRepos[i].Owner.Id,
-                               UserName:  collaRepos[i].Owner.Name,
-                               AvatarUrl: string(setting.Protocol) + collaRepos[i].Owner.AvatarLink(),
-                       },
-                       FullName:    collaRepos[i].Owner.Name + "/" + collaRepos[i].Name,
-                       Private:     collaRepos[i].IsPrivate,
-                       Fork:        collaRepos[i].IsFork,
-                       HtmlUrl:     setting.AppUrl + collaRepos[i].Owner.Name + "/" + collaRepos[i].Name,
-                       SshUrl:      fmt.Sprintf(sshUrlFmt, setting.RunUser, setting.Domain, collaRepos[i].Owner.LowerName, collaRepos[i].LowerName),
-                       Permissions: api.Permission{false, collaRepos[i].CanPush, true},
-               }
-               repos[j].CloneUrl = repos[j].HtmlUrl + ".git"
+               repos[j] = ToApiRepository(collaRepos[i].Owner, collaRepos[i].Repository, api.Permission{false, collaRepos[i].CanPush, true})
 
                // FIXME: cache result to reduce DB query?
-               if collaRepos[i].Owner.IsOrganization() && collaRepos[i].Owner.IsOrgOwner(ctx.User.Id) {
+               if collaRepos[i].Owner.IsOrganization() && collaRepos[i].Owner.IsOwnedBy(ctx.User.Id) {
                        repos[j].Permissions.Admin = true
                }
        }
index 5dddbc5a3d93d5334e80a2e02ae0a24afcc82f51..afe18a005842c5c336e6467701d7a28e542cbaf5 100644 (file)
@@ -48,15 +48,9 @@ func ListRepoHooks(ctx *middleware.Context) {
        ctx.JSON(200, &apiHooks)
 }
 
-type CreateRepoHookForm struct {
-       Type   string            `json:"type" binding:"Required"`
-       Config map[string]string `json:"config" binding:"Required"`
-       Active bool              `json:"active"`
-}
-
 // POST /repos/:username/:reponame/hooks
 // https://developer.github.com/v3/repos/hooks/#create-a-hook
-func CreateRepoHook(ctx *middleware.Context, form CreateRepoHookForm) {
+func CreateRepoHook(ctx *middleware.Context, form api.CreateHookOption) {
        if !models.IsValidHookTaskType(form.Type) {
                ctx.JSON(422, &base.ApiJsonErr{"invalid hook type", base.DOC_URL})
                return
@@ -124,14 +118,9 @@ func CreateRepoHook(ctx *middleware.Context, form CreateRepoHookForm) {
        ctx.JSON(201, apiHook)
 }
 
-type EditRepoHookForm struct {
-       Config map[string]string `json:"config"`
-       Active *bool             `json:"active"`
-}
-
 // PATCH /repos/:username/:reponame/hooks/:id
 // https://developer.github.com/v3/repos/hooks/#edit-a-hook
-func EditRepoHook(ctx *middleware.Context, form EditRepoHookForm) {
+func EditRepoHook(ctx *middleware.Context, form api.EditHookOption) {
        w, err := models.GetWebhookById(ctx.ParamsInt64(":id"))
        if err != nil {
                ctx.JSON(500, &base.ApiJsonErr{"GetWebhookById: " + err.Error(), base.DOC_URL})
index 15c423f72c02b5411f798068a760a10ece1f951a..e9ba615fcb9133c08d69d5bc197f3d3b0350f850 100644 (file)
@@ -12,8 +12,18 @@ import (
        "github.com/gogits/gogs/models"
        "github.com/gogits/gogs/modules/base"
        "github.com/gogits/gogs/modules/middleware"
+       "github.com/gogits/gogs/modules/setting"
 )
 
+// ToApiUser converts user to API format.
+func ToApiUser(u *models.User) *api.User {
+       return &api.User{
+               Id:        u.Id,
+               UserName:  u.Name,
+               AvatarUrl: string(setting.Protocol) + u.AvatarLink(),
+       }
+}
+
 func SearchUsers(ctx *middleware.Context) {
        opt := models.SearchOption{
                Keyword: ctx.Query("q"),
index 8e4ace994002ff9e32059ce81194f25a31470956..70b0c05ece8a5f59b6bc3cd8b037693fe646a9e3 100644 (file)
@@ -97,14 +97,14 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
 
        if ctxUser.IsOrganization() {
                // Check ownership of organization.
-               if !ctxUser.IsOrgOwner(ctx.User.Id) {
+               if !ctxUser.IsOwnedBy(ctx.User.Id) {
                        ctx.Error(403)
                        return
                }
        }
 
        repo, err := models.CreateRepository(ctxUser, form.RepoName, form.Description,
-               form.Gitignore, form.License, form.Private, false, form.InitReadme)
+               form.Gitignore, form.License, form.Private, false, form.AutoInit)
        if err == nil {
                log.Trace("Repository created: %s/%s", ctxUser.Name, repo.Name)
                ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
@@ -174,7 +174,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
 
        if ctxUser.IsOrganization() {
                // Check ownership of organization.
-               if !ctxUser.IsOrgOwner(ctx.User.Id) {
+               if !ctxUser.IsOwnedBy(ctx.User.Id) {
                        ctx.Error(403)
                        return
                }
@@ -292,7 +292,7 @@ func ForkPost(ctx *middleware.Context, form auth.CreateRepoForm) {
 
        if ctxUser.IsOrganization() {
                // Check ownership of organization.
-               if !ctxUser.IsOrgOwner(ctx.User.Id) {
+               if !ctxUser.IsOwnedBy(ctx.User.Id) {
                        ctx.Error(403)
                        return
                }
index 94c642b2b2258f2e3ced32eda02cbf4ce82231b7..aec79aa436364731e5ac685940e4d06e2ca28d31 100644 (file)
@@ -137,7 +137,7 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
                }
 
                if ctx.Repo.Owner.IsOrganization() {
-                       if !ctx.Repo.Owner.IsOrgOwner(ctx.User.Id) {
+                       if !ctx.Repo.Owner.IsOwnedBy(ctx.User.Id) {
                                ctx.Error(404)
                                return
                        }
index f69ca6c4b05ff3ed151654d4ca37a02c5ae95aa3..e5ab0b331ad6ee51dd88f792130a1ee44c202530 100644 (file)
@@ -1 +1 @@
-0.5.8.1211 Beta
\ No newline at end of file
+0.5.8.1212 Beta
\ No newline at end of file
index 5d0c9b0f1d5dfae42e8e17596bf42fb60aa3dcea..8b60b56856c307727d5779ab69cdda7ad0b3355b 100644 (file)
@@ -69,7 +69,7 @@
             </div>
             <div class="field">
                 <label for="init-readme"></label>
-                <input class="ipt-chk" id="init-readme" name="init_readme" type="checkbox" {{if .init_readme}}checked{{end}} />
+                <input class="ipt-chk" id="init-readme" name="auto_init" type="checkbox" {{if .auto_init}}checked{{end}} />
                 <strong>{{.i18n.Tr "repo.init_readme"}}</strong>
             </div>
             <div class="field">