Skip to content

Commit cf604f4

Browse files
committed
refactor & add node to fuc GetOrganizations
1 parent 4db71b3 commit cf604f4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

models/user.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ func (u *User) GetOwnedOrganizations() (err error) {
538538
}
539539

540540
// GetOrganizations returns paginated organizations that user belongs to.
541+
// TODO: does not respect All and show orgs you privately participate
541542
func (u *User) GetOrganizations(opts *SearchOrganizationsOptions) error {
542543
sess := x.NewSession()
543544
defer sess.Close()

routers/api/v1/org/org.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"code.gitea.io/gitea/routers/api/v1/utils"
1818
)
1919

20-
func listUserOrgs(ctx *context.APIContext, u *models.User, all bool) {
20+
func listUserOrgs(ctx *context.APIContext, u *models.User) {
2121

2222
listOptions := utils.GetListOptions(ctx)
2323
showPrivate := ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.ID == u.ID)
@@ -62,7 +62,7 @@ func ListMyOrgs(ctx *context.APIContext) {
6262
// "200":
6363
// "$ref": "#/responses/OrganizationList"
6464

65-
listUserOrgs(ctx, ctx.User, true)
65+
listUserOrgs(ctx, ctx.User)
6666
}
6767

6868
// ListUserOrgs list user's orgs
@@ -94,7 +94,7 @@ func ListUserOrgs(ctx *context.APIContext) {
9494
if ctx.Written() {
9595
return
9696
}
97-
listUserOrgs(ctx, u, ctx.User != nil && (ctx.User.IsAdmin || ctx.User.ID == u.ID))
97+
listUserOrgs(ctx, u)
9898
}
9999

100100
// GetAll return list of all public organizations

0 commit comments

Comments
 (0)