summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-12-12 20:30:32 -0500
committerUnknwon <joe2010xtmf@163.com>2014-12-12 20:30:32 -0500
commitac4a10456ea4515091c3c90a83a82c1e59cdf428 (patch)
treedb68f1f7a8f290322bd4da9892487cca5a1a5843 /modules
parent2f3a7e53cb58e922055baf3cf14138100a1f05ac (diff)
downloadgitea-ac4a10456ea4515091c3c90a83a82c1e59cdf428.tar.gz
gitea-ac4a10456ea4515091c3c90a83a82c1e59cdf428.zip
api: able to create repo and fix #726
- POST /user/repos - POST /org/:org/repos
Diffstat (limited to 'modules')
-rw-r--r--modules/auth/repo_form.go2
-rw-r--r--modules/middleware/org.go2
-rw-r--r--modules/middleware/repo.go4
3 files changed, 4 insertions, 4 deletions
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go
index 41c0217a93..36e62f04fb 100644
--- a/modules/auth/repo_form.go
+++ b/modules/auth/repo_form.go
@@ -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 {
diff --git a/modules/middleware/org.go b/modules/middleware/org.go
index be10298991..e687258617 100644
--- a/modules/middleware/org.go
+++ b/modules/middleware/org.go
@@ -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
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index 8b0f0c59f7..1716194925 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -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
}