diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-06-06 16:01:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-06 16:01:49 +0800 |
commit | 26095115f4ae90e3fdc6ab695978efd16e317f75 (patch) | |
tree | 92ec1c7ff54e0a65f4f0662baa8c0244dd9f324b /routers/web/explore | |
parent | ebeb6e7c71a0c763b52153f4eb427e7c5b89a95e (diff) | |
download | gitea-26095115f4ae90e3fdc6ab695978efd16e317f75.tar.gz gitea-26095115f4ae90e3fdc6ab695978efd16e317f75.zip |
Move some repository related code into sub package (#19711)
* Move some repository related code into sub package
* Move more repository functions out of models
* Fix lint
* Some performance optimization for webhooks and others
* some refactors
* Fix lint
* Fix
* Update modules/repository/delete.go
Co-authored-by: delvh <dev.lh@web.de>
* Fix test
* Merge
* Fix test
* Fix test
* Fix test
* Fix test
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'routers/web/explore')
-rw-r--r-- | routers/web/explore/code.go | 4 | ||||
-rw-r--r-- | routers/web/explore/repo.go | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/routers/web/explore/code.go b/routers/web/explore/code.go index 41ca27782f..3fba2be37d 100644 --- a/routers/web/explore/code.go +++ b/routers/web/explore/code.go @@ -55,7 +55,7 @@ func Code(ctx *context.Context) { // guest user or non-admin user if ctx.Doer == nil || !isAdmin { - repoIDs, err = models.FindUserAccessibleRepoIDs(ctx.Doer) + repoIDs, err = repo_model.FindUserAccessibleRepoIDs(ctx.Doer) if err != nil { ctx.ServerError("SearchResults", err) return @@ -79,7 +79,7 @@ func Code(ctx *context.Context) { rightRepoMap := make(map[int64]*repo_model.Repository, len(repoMaps)) repoIDs = make([]int64, 0, len(repoMaps)) for id, repo := range repoMaps { - if models.CheckRepoUnitUser(repo, ctx.Doer, unit.TypeCode) { + if models.CheckRepoUnitUser(ctx, repo, ctx.Doer, unit.TypeCode) { rightRepoMap[id] = repo repoIDs = append(repoIDs, id) } diff --git a/routers/web/explore/repo.go b/routers/web/explore/repo.go index 3e8aa2bb0f..f64642bc95 100644 --- a/routers/web/explore/repo.go +++ b/routers/web/explore/repo.go @@ -7,7 +7,6 @@ package explore import ( "net/http" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/modules/base" @@ -81,7 +80,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) { language := ctx.FormTrim("language") ctx.Data["Language"] = language - repos, count, err = models.SearchRepository(&models.SearchRepoOptions{ + repos, count, err = repo_model.SearchRepository(&repo_model.SearchRepoOptions{ ListOptions: db.ListOptions{ Page: page, PageSize: opts.PageSize, |