diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-01-15 10:19:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-15 02:19:25 +0000 |
commit | 70c4aad8e1cbc46b049b015dcd6f2e5be5a69e72 (patch) | |
tree | 5c9f049437c1a84a402aeef3be0cb4b95dea667e /modules/context/repo.go | |
parent | e5313248a8ed967a915f072d3991b6d046badf02 (diff) | |
download | gitea-70c4aad8e1cbc46b049b015dcd6f2e5be5a69e72.tar.gz gitea-70c4aad8e1cbc46b049b015dcd6f2e5be5a69e72.zip |
Move more functions to db.Find (#28419)
Following #28220
This PR move more functions to use `db.Find`.
---------
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r-- | modules/context/repo.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index 882a406731..8d82be1990 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -536,18 +536,20 @@ func RepoAssignment(ctx *Context) context.CancelFunc { ctx.Data["RepoExternalIssuesLink"] = unit.ExternalTrackerConfig().ExternalTrackerURL } - ctx.Data["NumTags"], err = repo_model.GetReleaseCountByRepoID(ctx, ctx.Repo.Repository.ID, repo_model.FindReleasesOptions{ + ctx.Data["NumTags"], err = db.Count[repo_model.Release](ctx, repo_model.FindReleasesOptions{ IncludeDrafts: true, IncludeTags: true, HasSha1: util.OptionalBoolTrue, // only draft releases which are created with existing tags + RepoID: ctx.Repo.Repository.ID, }) if err != nil { ctx.ServerError("GetReleaseCountByRepoID", err) return nil } - ctx.Data["NumReleases"], err = repo_model.GetReleaseCountByRepoID(ctx, ctx.Repo.Repository.ID, repo_model.FindReleasesOptions{ + ctx.Data["NumReleases"], err = db.Count[repo_model.Release](ctx, repo_model.FindReleasesOptions{ // only show draft releases for users who can write, read-only users shouldn't see draft releases. IncludeDrafts: ctx.Repo.CanWrite(unit_model.TypeReleases), + RepoID: ctx.Repo.Repository.ID, }) if err != nil { ctx.ServerError("GetReleaseCountByRepoID", err) |