File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -454,18 +454,22 @@ type FindOrgOptions struct {
454454func (opts FindOrgOptions ) toConds () builder.Cond {
455455 var cond = builder .NewCond ()
456456 if opts .UserID > 0 {
457- cond = cond .And (builder.Eq { "`org_user`.uid" : opts .UserID } )
457+ cond = cond .And (builder .In ( "`user`.`id`" , queryUserOrgIDs ( opts .UserID )) )
458458 }
459459 if ! opts .IncludePrivate {
460460 cond = cond .And (builder.Eq {"`user`.visibility" : structs .VisibleTypePublic })
461+ } else {
462+ cond = cond .And (builder.Eq {"`user`.visibility" : structs .VisibleTypePrivate }.Or (
463+ builder.Eq {"`user`.visibility" : structs .VisibleTypeLimited },
464+ ))
461465 }
462466 return cond
463467}
464468
465469// FindOrgs returns a list of organizations according given conditions
466470func FindOrgs (opts FindOrgOptions ) ([]* User , error ) {
467471 orgs := make ([]* User , 0 , 10 )
468- sess := x .Join ( "INNER" , "`org_user`" , "`org_user`.org_id=`user`.id" ).
472+ sess := x .
469473 Where (opts .toConds ()).
470474 Asc ("`user`.name" )
471475 if opts .Page > 0 && opts .PageSize > 0 {
You can’t perform that action at this time.
0 commit comments