aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-03-03 10:57:27 -0500
committerUnknwon <u@gogs.io>2016-03-03 10:57:27 -0500
commitc9901bbba5dd2761f2920d6a122799ee051fc7cd (patch)
tree47c72d48a4fcceca9dca524fa914983e53866f9c /models
parent4d930f359827f56148adc82300677f20059ec1cf (diff)
downloadgitea-c9901bbba5dd2761f2920d6a122799ee051fc7cd.tar.gz
gitea-c9901bbba5dd2761f2920d6a122799ee051fc7cd.zip
#2743 workaround to fix XORM problem
Diffstat (limited to 'models')
-rw-r--r--models/org.go6
1 files changed, 2 insertions, 4 deletions
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, ",")).