aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-09-25 19:05:27 -0400
committer无闻 <u@gogs.io>2015-09-25 19:05:27 -0400
commit84c727ae6657c89885a5039a4dcd77d6be3fcf01 (patch)
treee60259775b75da7a1d5e709264dc80632423f9f3 /models
parentee1256cf74f7f42f19fa22f77100aed78ad94987 (diff)
parentdfc16d08790f446e321df24c01ae2800507e2a22 (diff)
downloadgitea-84c727ae6657c89885a5039a4dcd77d6be3fcf01.tar.gz
gitea-84c727ae6657c89885a5039a4dcd77d6be3fcf01.zip
Merge pull request #1693 from sapk/fix-admin-repo-new-ui
Fix admin repos new ui
Diffstat (limited to 'models')
-rw-r--r--models/repo.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/models/repo.go b/models/repo.go
index 8b80533813..c05c0098f2 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -775,15 +775,13 @@ func CountRepositories() int64 {
func CountPublicRepositories() int64 {
return countRepositories(false)
}
-
-// GetRepositoriesWithUsers returns given number of repository objects with offset.
-// It also auto-gets corresponding users.
-func GetRepositoriesWithUsers(num, offset int) ([]*Repository, error) {
- repos := make([]*Repository, 0, num)
- if err := x.Limit(num, offset).Asc("id").Find(&repos); err != nil {
+// RepositoriesWithUsers returns number of repos in given page.
+func RepositoriesWithUsers(page, pageSize int) ([]*Repository, error) {
+ repos := make([]*Repository, 0, pageSize)
+ if err := x.Limit(pageSize, (page-1)*pageSize).Asc("id").Find(&repos); err != nil {
return nil, err
}
-
+
for _, repo := range repos {
repo.Owner = &User{Id: repo.OwnerID}
has, err := x.Get(repo.Owner)
@@ -795,6 +793,7 @@ func GetRepositoriesWithUsers(num, offset int) ([]*Repository, error) {
}
return repos, nil
+
}
// RepoPath returns repository path by given user and repository name.