Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of dashboard list orgs #16099

Merged
merged 6 commits into from
Jun 14, 2021
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
unexport queryUserOrgIDs method
  • Loading branch information
lunny committed Jun 14, 2021
commit 474c950cb72a3d78365ba6ec65ce5e8ed35a8906
6 changes: 3 additions & 3 deletions models/org.go
Original file line number Diff line number Diff line change
@@ -425,8 +425,8 @@ func GetOrgsByUserID(userID int64, showAll bool) ([]*User, error) {
return getOrgsByUserID(sess, userID, showAll)
}

// QueryUserOrgIDs returns a condition to return user's organization id
func QueryUserOrgIDs(uid int64) *builder.Builder {
// queryUserOrgIDs returns a condition to return user's organization id
func queryUserOrgIDs(uid int64) *builder.Builder {
return builder.Select("team.org_id").
From("team_user").InnerJoin("team", "team.id = team_user.team_id").
Where(builder.Eq{"team_user.uid": uid})
@@ -440,7 +440,7 @@ func GetUserOrgsList(uid int64) ([]*SimpleOrg, error) {
var orgs = make([]*SimpleOrg, 0, 20)
return orgs, x.Select("id, name, full_name, visibility, avatar, avatar_email, use_custom_avatar").
Table("user").
In("id", QueryUserOrgIDs(uid)).
In("id", queryUserOrgIDs(uid)).
Find(&orgs)
}