feat: Add search bar on user profile page. (#787)

This commit is contained in:
Bo-Yi Wu 2017-02-04 20:20:20 +08:00 committed by Lunny Xiao
parent de81f68d4d
commit a90a215662
6 changed files with 69 additions and 10 deletions

View file

@ -1579,10 +1579,14 @@ func GetRepositoryByID(id int64) (*Repository, error) {
}
// GetUserRepositories returns a list of repositories of given user.
func GetUserRepositories(userID int64, private bool, page, pageSize int) ([]*Repository, error) {
func GetUserRepositories(userID int64, private bool, page, pageSize int, orderBy string) ([]*Repository, error) {
if len(orderBy) == 0 {
orderBy = "updated_unix DESC"
}
sess := x.
Where("owner_id = ?", userID).
Desc("updated_unix")
OrderBy(orderBy)
if !private {
sess.And("is_private=?", false)
}