feat(UI): add package counter to repo/user/org overview pages

- add package counter to repo/user/org overview pages
    - add go unit tests for repo/user has/count packages
    - add many more unit tests for packages model
    - fix error for non-existing packages in DeletePackageByID and SetRepositoryLink
This commit is contained in:
Robert Wolff 2024-07-31 12:40:24 +02:00
commit 994bd93e69
8 changed files with 341 additions and 25 deletions

View file

@ -24,6 +24,10 @@
{{if and .IsPackageEnabled (or .ContextUser.IsIndividual .CanReadPackages)}}
<a href="{{.ContextUser.HomeLink}}/-/packages" class="{{if .IsPackagesPage}}active {{end}}item">
{{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}}
{{if .PackageCount}}
<div class="ui small label">{{.PackageCount}}</div>
{{end}}
<span hidden test-name="package-count">{{.PackageCount}}</span>
</a>
{{end}}
{{if and .IsRepoIndexerEnabled (or .ContextUser.IsIndividual .CanReadCode)}}