mirror of
https://github.com/go-gitea/gitea
synced 2025-07-12 13:37:20 +00:00
Hide internal package versions (#20492)
* Hide internal versions from most searches. * Added test.
This commit is contained in:
@ -11,6 +11,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/routers/api/v1/utils"
|
||||
packages_service "code.gitea.io/gitea/services/packages"
|
||||
)
|
||||
@ -55,10 +56,11 @@ func ListPackages(ctx *context.APIContext) {
|
||||
query := ctx.FormTrim("q")
|
||||
|
||||
pvs, count, err := packages.SearchVersions(ctx, &packages.PackageSearchOptions{
|
||||
OwnerID: ctx.Package.Owner.ID,
|
||||
Type: packages.Type(packageType),
|
||||
Name: packages.SearchValue{Value: query},
|
||||
Paginator: &listOptions,
|
||||
OwnerID: ctx.Package.Owner.ID,
|
||||
Type: packages.Type(packageType),
|
||||
Name: packages.SearchValue{Value: query},
|
||||
IsInternal: util.OptionalBoolFalse,
|
||||
Paginator: &listOptions,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "SearchVersions", err)
|
||||
|
Reference in New Issue
Block a user