diff options
author | Bo-Yi Wu <appleboy.tw@gmail.com> | 2017-02-04 20:20:20 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-02-04 20:20:20 +0800 |
commit | a90a215662636fed1a2c67b49cf060e2936822f6 (patch) | |
tree | 78ff0fbcb36fb252e671fdbff6011483aca53ce6 /models/repo.go | |
parent | de81f68d4d4a87c044034be682abffaccd399860 (diff) | |
download | gitea-a90a215662636fed1a2c67b49cf060e2936822f6.tar.gz gitea-a90a215662636fed1a2c67b49cf060e2936822f6.zip |
feat: Add search bar on user profile page. (#787)
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/models/repo.go b/models/repo.go index 51e8f6351d..3a503d8953 100644 --- a/models/repo.go +++ b/models/repo.go @@ -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) } |