|
|
@ -1072,14 +1072,14 @@ func CountUserRepositories(userID int64, private bool) int64 { |
|
|
|
return countRepositories(userID, private) |
|
|
|
return countRepositories(userID, private) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Repositories(page, pageSize int) (_ []*Repository, err error) { |
|
|
|
func Repositories(page, pageSize int, _ int64) (_ []*Repository, err error) { |
|
|
|
repos := make([]*Repository, 0, pageSize) |
|
|
|
repos := make([]*Repository, 0, pageSize) |
|
|
|
return repos, x.Limit(pageSize, (page-1)*pageSize).Asc("id").Find(&repos) |
|
|
|
return repos, x.Limit(pageSize, (page-1)*pageSize).Asc("id").Find(&repos) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// RepositoriesWithUsers returns number of repos in given page.
|
|
|
|
// RepositoriesWithUsers returns number of repos in given page.
|
|
|
|
func RepositoriesWithUsers(page, pageSize int) (_ []*Repository, err error) { |
|
|
|
func RepositoriesWithUsers(page, pageSize int) (_ []*Repository, err error) { |
|
|
|
repos, err := Repositories(page, pageSize) |
|
|
|
repos, err := Repositories(page, pageSize, -1) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, fmt.Errorf("Repositories: %v", err) |
|
|
|
return nil, fmt.Errorf("Repositories: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
@ -1553,9 +1553,18 @@ func GetUserMirrorRepositories(userID int64) ([]*Repository, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
|
|
|
|
// GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
|
|
|
|
func GetRecentUpdatedRepositories(page, pageSize int) (repos []*Repository, err error) { |
|
|
|
func GetRecentUpdatedRepositories(page, pageSize int, userID int64) (repos []*Repository, err error) { |
|
|
|
return repos, x.Limit(pageSize, (page-1)*pageSize). |
|
|
|
repos, _, err = SearchRepositoryByName(&SearchRepoOptions{ |
|
|
|
Where("is_private=?", false).Limit(pageSize).Desc("updated_unix").Find(&repos) |
|
|
|
Keyword: "%", |
|
|
|
|
|
|
|
UserID: userID, |
|
|
|
|
|
|
|
OrderBy: "updated_unix DESC", |
|
|
|
|
|
|
|
Private: false, |
|
|
|
|
|
|
|
Page: page, |
|
|
|
|
|
|
|
PageSize: pageSize, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return repos, err |
|
|
|
|
|
|
|
//return repos, x.Limit(pageSize, (page-1)*pageSize).
|
|
|
|
|
|
|
|
// Where("is_private=?", false).Limit(pageSize).Desc("updated_unix").Find(&repos)
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func getRepositoryCount(e Engine, u *User) (int64, error) { |
|
|
|
func getRepositoryCount(e Engine, u *User) (int64, error) { |
|
|
|