aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2023-03-13 20:31:41 +0900
committerGitHub <noreply@github.com>2023-03-13 11:31:41 +0000
commitd74a7efb60f94a4b8e6e5f65332f94f1be31b761 (patch)
treed59b2946cb8d957ef71c7ef5f7d8f59396c7b475 /models/repo
parentcdc9e91750036fc370db65a44618f3139db11ae1 (diff)
downloadgitea-d74a7efb60f94a4b8e6e5f65332f94f1be31b761.tar.gz
gitea-d74a7efb60f94a4b8e6e5f65332f94f1be31b761.zip
Use context for `RepositoryList.LoadAttributes` (#23435)
Diffstat (limited to 'models/repo')
-rw-r--r--models/repo/repo_list.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/models/repo/repo_list.go b/models/repo/repo_list.go
index d9cd905a19..92b9c15b4b 100644
--- a/models/repo/repo_list.go
+++ b/models/repo/repo_list.go
@@ -62,7 +62,8 @@ func RepositoryListOfMap(repoMap map[int64]*Repository) RepositoryList {
return RepositoryList(ValuesRepository(repoMap))
}
-func (repos RepositoryList) loadAttributes(ctx context.Context) error {
+// LoadAttributes loads the attributes for the given RepositoryList
+func (repos RepositoryList) LoadAttributes(ctx context.Context) error {
if len(repos) == 0 {
return nil
}
@@ -107,11 +108,6 @@ func (repos RepositoryList) loadAttributes(ctx context.Context) error {
return nil
}
-// LoadAttributes loads the attributes for the given RepositoryList
-func (repos RepositoryList) LoadAttributes() error {
- return repos.loadAttributes(db.DefaultContext)
-}
-
// SearchRepoOptions holds the search options
type SearchRepoOptions struct {
db.ListOptions
@@ -547,7 +543,7 @@ func SearchRepositoryByCondition(ctx context.Context, opts *SearchRepoOptions, c
}
if loadAttributes {
- if err := repos.loadAttributes(ctx); err != nil {
+ if err := repos.LoadAttributes(ctx); err != nil {
return nil, 0, fmt.Errorf("LoadAttributes: %w", err)
}
}