aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/context/repo.go6
-rw-r--r--modules/repository/repo.go3
2 files changed, 6 insertions, 3 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)
diff --git a/modules/repository/repo.go b/modules/repository/repo.go
index a9a2773501..33363e4689 100644
--- a/modules/repository/repo.go
+++ b/modules/repository/repo.go
@@ -299,10 +299,11 @@ func SyncReleasesWithTags(ctx context.Context, repo *repo_model.Repository, gitR
IncludeDrafts: true,
IncludeTags: true,
ListOptions: db.ListOptions{PageSize: 50},
+ RepoID: repo.ID,
}
for page := 1; ; page++ {
opts.Page = page
- rels, err := repo_model.GetReleasesByRepoID(gitRepo.Ctx, repo.ID, opts)
+ rels, err := db.Find[repo_model.Release](gitRepo.Ctx, opts)
if err != nil {
return fmt.Errorf("unable to GetReleasesByRepoID in Repo[%d:%s/%s]: %w", repo.ID, repo.OwnerName, repo.Name, err)
}