diff options
Diffstat (limited to 'routers/api/v1/org')
-rw-r--r-- | routers/api/v1/org/org.go | 12 | ||||
-rw-r--r-- | routers/api/v1/org/team.go | 7 |
2 files changed, 3 insertions, 16 deletions
diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go index b4e52d4862..5b1ea007e3 100644 --- a/routers/api/v1/org/org.go +++ b/routers/api/v1/org/org.go @@ -42,20 +42,12 @@ func ListUserOrgs(ctx *context.APIContext) { // https://github.com/gogits/go-gogs-client/wiki/Organizations#get-an-organization func Get(ctx *context.APIContext) { - org := user.GetUserByParamsName(ctx, ":orgname") - if ctx.Written() { - return - } - ctx.JSON(200, convert.ToOrganization(org)) + ctx.JSON(200, convert.ToOrganization(ctx.Org.Organization)) } // https://github.com/gogits/go-gogs-client/wiki/Organizations#edit-an-organization func Edit(ctx *context.APIContext, form api.EditOrgOption) { - org := user.GetUserByParamsName(ctx, ":orgname") - if ctx.Written() { - return - } - + org := ctx.Org.Organization if !org.IsOwnedBy(ctx.User.Id) { ctx.Status(403) return diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go index fad0d2f703..70f8d84206 100644 --- a/routers/api/v1/org/team.go +++ b/routers/api/v1/org/team.go @@ -9,15 +9,10 @@ import ( "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/routers/api/v1/convert" - "github.com/gogits/gogs/routers/api/v1/user" ) func ListTeams(ctx *context.APIContext) { - org := user.GetUserByParamsName(ctx, ":orgname") - if ctx.Written() { - return - } - + org := ctx.Org.Organization if err := org.GetTeams(); err != nil { ctx.Error(500, "GetTeams", err) return |