diff options
author | Bo-Yi Wu <appleboy.tw@gmail.com> | 2017-02-15 22:28:11 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-02-15 22:28:11 +0800 |
commit | a31f64d639f32ee4ef428e76277eb0b0bf5616c4 (patch) | |
tree | 28224755e6d21359b6937300fe807dd2828d71af /models | |
parent | 9d2b830275bf766b9f5e48e3be4b785dc1b2134a (diff) | |
download | gitea-a31f64d639f32ee4ef428e76277eb0b0bf5616c4.tar.gz gitea-a31f64d639f32ee4ef428e76277eb0b0bf5616c4.zip |
fix: 500 error on /explore/repos page. (#946)
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/models/repo.go b/models/repo.go index 55e9d4b1c9..13ff6dd4f7 100644 --- a/models/repo.go +++ b/models/repo.go @@ -1198,10 +1198,8 @@ func Repositories(opts *SearchRepoOptions) (_ RepositoryList, err error) { return nil, fmt.Errorf("Repo: %v", err) } - if opts.Searcher != nil || opts.Starred { - if err = repos.loadAttributes(x); err != nil { - return nil, fmt.Errorf("LoadAttributes: %v", err) - } + if err = repos.loadAttributes(x); err != nil { + return nil, fmt.Errorf("LoadAttributes: %v", err) } return repos, nil @@ -1743,10 +1741,8 @@ func GetRecentUpdatedRepositories(opts *SearchRepoOptions) (repos RepositoryList return nil, fmt.Errorf("Repo: %v", err) } - if opts.Searcher != nil || opts.Starred { - if err = repos.loadAttributes(x); err != nil { - return nil, fmt.Errorf("LoadAttributes: %v", err) - } + if err = repos.loadAttributes(x); err != nil { + return nil, fmt.Errorf("LoadAttributes: %v", err) } return repos, nil @@ -1781,14 +1777,15 @@ func GetPrivateRepositoryCount(u *User) (int64, error) { // SearchRepoOptions holds the search options type SearchRepoOptions struct { - Keyword string - OwnerID int64 - Searcher *User //ID of the person who's seeking - OrderBy string - Private bool // Include private repositories in results - Starred bool - Page int - PageSize int // Can be smaller than or equal to setting.ExplorePagingNum + Keyword string + OwnerID int64 + Searcher *User //ID of the person who's seeking + OrderBy string + Private bool // Include private repositories in results + Starred bool + Page int + IsProfile bool + PageSize int // Can be smaller than or equal to setting.ExplorePagingNum } // SearchRepositoryByName takes keyword and part of repository name to search, @@ -1856,7 +1853,7 @@ func SearchRepositoryByName(opts *SearchRepoOptions) (repos RepositoryList, _ in return nil, 0, fmt.Errorf("Repo: %v", err) } - if opts.Searcher != nil || opts.Starred { + if !opts.IsProfile { if err = repos.loadAttributes(x); err != nil { return nil, 0, fmt.Errorf("LoadAttributes: %v", err) } |