aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorKim Carlbäcker <kim.carlbacker@gmail.com>2016-05-07 02:02:36 +0200
committerUnknwon <u@gogs.io>2016-05-06 20:02:36 -0400
commit3c0c7a9f83effc7415a500309c6a27648bfb7005 (patch)
tree65cc1d104069cd45a6b981c9b4369f4411432c22 /models
parent13216c5c206fda7d84d372e33a02ac8213d9949c (diff)
downloadgitea-3c0c7a9f83effc7415a500309c6a27648bfb7005.tar.gz
gitea-3c0c7a9f83effc7415a500309c6a27648bfb7005.zip
Fix listing team members (#3048)
Diffstat (limited to 'models')
-rw-r--r--models/org.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/models/org.go b/models/org.go
index 540498d1c0..bac3ad25ca 100644
--- a/models/org.go
+++ b/models/org.go
@@ -443,7 +443,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, org.NumTeams)
- if err = x.Sql(`SELECT team.id FROM team
+ if err = x.Sql(`SELECT team.id FROM team
INNER JOIN team_user ON team_user.team_id = team.id
WHERE team_user.org_id = ? AND team_user.uid = ?`, org.Id, userID).Find(&teams); err != nil {
return fmt.Errorf("get teams: %v", err)
@@ -484,6 +484,8 @@ WHERE team_user.org_id = ? AND team_user.uid = ?`,
return fmt.Errorf("get teams: %v", err)
}
+ org.Teams = teams
+
// FIXME: should I change this value inside method,
// or only in location of caller where it's really needed?
org.NumTeams = len(org.Teams)