diff options
author | Thibault Meyer <meyer.thibault@gmail.com> | 2016-11-10 16:16:32 +0100 |
---|---|---|
committer | Thibault Meyer <meyer.thibault@gmail.com> | 2016-11-10 20:59:51 +0100 |
commit | a4454f5d0fbeaacb94668012acbb4296465cb28f (patch) | |
tree | eaf39d1935eda44cf16df08234d2bbddd39c3ddd /models/access.go | |
parent | c040f2fbb13ef5ba2c6a619322d4801e9f78c885 (diff) | |
download | gitea-a4454f5d0fbeaacb94668012acbb4296465cb28f.tar.gz gitea-a4454f5d0fbeaacb94668012acbb4296465cb28f.zip |
Rewrite XORM queries
Diffstat (limited to 'models/access.go')
-rw-r--r-- | models/access.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/models/access.go b/models/access.go index fa3642cf53..3c3655ead6 100644 --- a/models/access.go +++ b/models/access.go @@ -124,14 +124,18 @@ func (u *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error) { // GetAccessibleRepositories finds repositories which the user has access but does not own. // If limit is smaller than 1 means returns all found results. func (user *User) GetAccessibleRepositories(limit int) (repos []*Repository, _ error) { - sess := x.Where("owner_id !=? ", user.ID).Desc("updated_unix") + sess := x. + Where("owner_id !=? ", user.ID). + Desc("updated_unix") if limit > 0 { sess.Limit(limit) repos = make([]*Repository, 0, limit) } else { repos = make([]*Repository, 0, 10) } - return repos, sess.Join("INNER", "access", "access.user_id = ? AND access.repo_id = repository.id", user.ID).Find(&repos) + return repos, sess. + Join("INNER", "access", "access.user_id = ? AND access.repo_id = repository.id", user.ID). + Find(&repos) } func maxAccessMode(modes ...AccessMode) AccessMode { |