diff options
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/models/repo.go b/models/repo.go index 01736b631d..1a5a95f047 100644 --- a/models/repo.go +++ b/models/repo.go @@ -714,9 +714,14 @@ func GetRepositoryById(id int64) (*Repository, error) { } // GetRepositories returns the list of repositories of given user. -func GetRepositories(user *User) ([]Repository, error) { +func GetRepositories(user *User, private bool) ([]Repository, error) { repos := make([]Repository, 0, 10) - err := orm.Desc("updated").Find(&repos, &Repository{OwnerId: user.Id}) + sess := orm.Desc("updated") + if !private { + sess.Where("is_private=?", false) + } + + err := sess.Find(&repos, &Repository{OwnerId: user.Id}) return repos, err } |