Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix bug
  • Loading branch information
lunny committed Nov 21, 2021
commit b2fc08afc827e95fcfaade7df93781ccd75e6088
8 changes: 4 additions & 4 deletions models/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,21 +440,21 @@ func getUsersWhoCanCreateOrgRepo(e db.Engine, orgID int64) ([]*User, error) {
And("team_user.org_id = ?", orgID).Asc("`user`.name").Find(&users)
}

func getOrgsByUserID(sess db.Engine, userID int64, showAll bool) ([]*User, error) {
func getOrgsByUserID(e db.Engine, userID int64, showAll bool) ([]*Organization, error) {
orgs := make([]*Organization, 0, 10)
sess := e.Where("`org_user`.uid=?", userID)
if !showAll {
sess.Where("`org_user`.is_public=?", true)
sess = sess.Where("`org_user`.is_public=?", true)
}
return orgs, sess.
Where("`org_user`.uid=?", userID).
Join("INNER", "`org_user`", "`org_user`.org_id=`user`.id").
Asc("`user`.name").
Find(&orgs)
}

// GetOrgsByUserID returns a list of organizations that the given user ID
// has joined.
func GetOrgsByUserID(userID int64, showAll bool) ([]*User, error) {
func GetOrgsByUserID(userID int64, showAll bool) ([]*Organization, error) {
return getOrgsByUserID(db.GetEngine(db.DefaultContext), userID, showAll)
}

Expand Down