mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-24 16:16:35 -05:00
fix: 500 error on /explore/repos page. (#946)
This commit is contained in:
parent
9d2b830275
commit
a31f64d639
2 changed files with 21 additions and 23 deletions
|
@ -1198,11 +1198,9 @@ func Repositories(opts *SearchRepoOptions) (_ RepositoryList, err error) {
|
||||||
return nil, fmt.Errorf("Repo: %v", err)
|
return nil, fmt.Errorf("Repo: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.Searcher != nil || opts.Starred {
|
|
||||||
if err = repos.loadAttributes(x); err != nil {
|
if err = repos.loadAttributes(x); err != nil {
|
||||||
return nil, fmt.Errorf("LoadAttributes: %v", err)
|
return nil, fmt.Errorf("LoadAttributes: %v", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return repos, nil
|
return repos, nil
|
||||||
}
|
}
|
||||||
|
@ -1743,11 +1741,9 @@ func GetRecentUpdatedRepositories(opts *SearchRepoOptions) (repos RepositoryList
|
||||||
return nil, fmt.Errorf("Repo: %v", err)
|
return nil, fmt.Errorf("Repo: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.Searcher != nil || opts.Starred {
|
|
||||||
if err = repos.loadAttributes(x); err != nil {
|
if err = repos.loadAttributes(x); err != nil {
|
||||||
return nil, fmt.Errorf("LoadAttributes: %v", err)
|
return nil, fmt.Errorf("LoadAttributes: %v", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return repos, nil
|
return repos, nil
|
||||||
}
|
}
|
||||||
|
@ -1788,6 +1784,7 @@ type SearchRepoOptions struct {
|
||||||
Private bool // Include private repositories in results
|
Private bool // Include private repositories in results
|
||||||
Starred bool
|
Starred bool
|
||||||
Page int
|
Page int
|
||||||
|
IsProfile bool
|
||||||
PageSize int // Can be smaller than or equal to setting.ExplorePagingNum
|
PageSize int // Can be smaller than or equal to setting.ExplorePagingNum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1856,7 +1853,7 @@ func SearchRepositoryByName(opts *SearchRepoOptions) (repos RepositoryList, _ in
|
||||||
return nil, 0, fmt.Errorf("Repo: %v", err)
|
return nil, 0, fmt.Errorf("Repo: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.Searcher != nil || opts.Starred {
|
if !opts.IsProfile {
|
||||||
if err = repos.loadAttributes(x); err != nil {
|
if err = repos.loadAttributes(x); err != nil {
|
||||||
return nil, 0, fmt.Errorf("LoadAttributes: %v", err)
|
return nil, 0, fmt.Errorf("LoadAttributes: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,7 @@ func Profile(ctx *context.Context) {
|
||||||
OrderBy: orderBy,
|
OrderBy: orderBy,
|
||||||
Private: showPrivate,
|
Private: showPrivate,
|
||||||
Page: page,
|
Page: page,
|
||||||
|
IsProfile: true,
|
||||||
PageSize: setting.UI.User.RepoPagingNum,
|
PageSize: setting.UI.User.RepoPagingNum,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue