From c9901bbba5dd2761f2920d6a122799ee051fc7cd Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 3 Mar 2016 10:57:27 -0500 Subject: #2743 workaround to fix XORM problem --- models/org.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'models') diff --git a/models/org.go b/models/org.go index f70d182c7b..680518c163 100644 --- a/models/org.go +++ b/models/org.go @@ -1055,8 +1055,7 @@ func RemoveOrgRepo(orgID, repoID int64) error { // that the user with the given userID has access to. func (org *User) GetUserRepositories(userID int64) (err error) { teams := make([]*Team, 0, 10) - if err = x.Cols("`team`.id"). - Where("`team_user`.org_id=?", org.Id). + if err = x.Where("`team_user`.org_id=?", org.Id). And("`team_user`.uid=?", userID). Join("INNER", "`team_user`", "`team_user`.team_id=`team`.id"). Find(&teams); err != nil { @@ -1076,8 +1075,7 @@ func (org *User) GetUserRepositories(userID int64) (err error) { // As a workaround, we have to build the IN statement on our own, until this is fixed. // https://github.com/go-xorm/xorm/issues/342 - if err = x.Cols("`repository`.*"). - Join("INNER", "`team_repo`", "`team_repo`.repo_id=`repository`.id"). + if err = x.Join("INNER", "`team_repo`", "`team_repo`.repo_id=`repository`.id"). Where("`repository`.owner_id=?", org.Id). And("`repository`.is_private=?", false). Or("`team_repo`.team_id IN (?)", strings.Join(teamIDs, ",")). -- cgit v1.2.3