forked from NYANDEV/forgejo
Hide internal package versions (#20492)
* Hide internal versions from most searches. * Added test.
This commit is contained in:
parent
5ed082b624
commit
a3d55ac523
12 changed files with 66 additions and 31 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue