Correctly set the organization num repos (#11339)

* Correctly set the organization num repos

Correctly set the organization num repos to the number of
accessible repos for the user

Fix #11194

Signed-off-by: Andrew Thornton <art27@cantab.net>

* as per @lunny

Signed-off-by: Andrew Thornton <art27@cantab.net>

* attempt to fix mssql

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update models/user.go

* Explicit columns

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Add test and fix 0 counted orgs

Signed-off-by: Andrew Thornton <art27@cantab.net>

* remove orgname from api

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath
2020-05-11 23:04:08 +01:00
committed by GitHub
parent 45968b9f44
commit c42c31a111
4 changed files with 268 additions and 11 deletions

View File

@ -383,7 +383,7 @@ func orgAssignment(args ...bool) macaron.Handler {
var err error
if assignOrg {
ctx.Org.Organization, err = models.GetOrgByName(ctx.Params(":orgname"))
ctx.Org.Organization, err = models.GetOrgByName(ctx.Params(":org"))
if err != nil {
if models.IsErrOrgNotExist(err) {
ctx.NotFound()
@ -857,7 +857,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/users/:username/orgs", org.ListUserOrgs)
m.Post("/orgs", reqToken(), bind(api.CreateOrgOption{}), org.Create)
m.Get("/orgs", org.GetAll)
m.Group("/orgs/:orgname", func() {
m.Group("/orgs/:org", func() {
m.Combo("").Get(org.Get).
Patch(reqToken(), reqOrgOwnership(), bind(api.EditOrgOption{}), org.Edit).
Delete(reqToken(), reqOrgOwnership(), org.Delete)
@ -907,7 +907,7 @@ func RegisterRoutes(m *macaron.Macaron) {
})
m.Group("/repos", func() {
m.Get("", org.GetTeamRepos)
m.Combo("/:orgname/:reponame").
m.Combo("/:org/:reponame").
Put(org.AddTeamRepository).
Delete(org.RemoveTeamRepository)
})