From 6f323d13dd0e978a4e3795e93600cb115dbd80a6 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Wed, 14 Dec 2022 18:49:44 +0100 Subject: [PATCH] Fix condition for is_internal (#22095) (#22131) Backport of #22095 I changed it to a static condition because it needs a new version of xorm which is only available in 1.19. This change is valid because `SearchLatestVersions` is never called to list internal versions and there will no change to this behaviour in <1.19. Co-authored-by: Lunny Xiao Co-authored-by: techknowlogick --- models/packages/package_version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/packages/package_version.go b/models/packages/package_version.go index 78e76c505..261a0285d 100644 --- a/models/packages/package_version.go +++ b/models/packages/package_version.go @@ -289,7 +289,7 @@ func SearchLatestVersions(ctx context.Context, opts *PackageSearchOptions) ([]*P sess := db.GetEngine(ctx). Table("package_version"). - Join("LEFT", "package_version pv2", "package_version.package_id = pv2.package_id AND (package_version.created_unix < pv2.created_unix OR (package_version.created_unix = pv2.created_unix AND package_version.id < pv2.id))"). + Join("LEFT", "package_version pv2", "package_version.package_id = pv2.package_id AND pv2.is_internal = ? AND (package_version.created_unix < pv2.created_unix OR (package_version.created_unix = pv2.created_unix AND package_version.id < pv2.id))", false). Join("INNER", "package", "package.id = package_version.package_id"). Where(cond)