@@ -928,14 +928,19 @@ public virtual async Task<ActionResult> DisplayPackage(string id, string version
928928
929929 IReadOnlyCollection < Package > allVersions ;
930930
931+ bool hasMoreVersions = false ;
932+
931933 if ( _featureFlagService . IsReducedVersionListsEnabled ( ) )
932934 {
933- allVersions = _packageService . FindLatestVersionsById ( id ,
935+ LatestPackageVersionsResult latestVersions = _packageService . FindLatestVersionsById ( id ,
934936 includeVersion : normalized ,
935937 includePackageRegistration : true ,
936938 includeDeprecations : true ,
937939 includeSupportedFrameworks : true ,
938940 maxCount : 20 ) ;
941+
942+ allVersions = latestVersions . Packages ;
943+ hasMoreVersions = latestVersions . HasMoreResults ;
939944 }
940945 else
941946 {
@@ -1008,6 +1013,7 @@ public virtual async Task<ActionResult> DisplayPackage(string id, string version
10081013 model . IsMarkdigMdSyntaxHighlightEnabled = _featureFlagService . IsMarkdigMdSyntaxHighlightEnabled ( ) ;
10091014 model . IsMcpServerPackageDisplayEnabled = _featureFlagService . IsMcpServerPackageDisplayEnabled ( ) ;
10101015 model . CanDisplayReadmeWarning = canDisplayReadmeWarning ;
1016+ model . HasMoreVersions = hasMoreVersions ;
10111017
10121018 if ( model . IsComputeTargetFrameworkEnabled || model . IsDisplayTargetFrameworkEnabled )
10131019 {
@@ -2422,6 +2428,73 @@ public virtual Task<ActionResult> RejectPendingOwnershipRequest(string id, strin
24222428 return HandleOwnershipRequest ( id , username , token , redirect : false , accept : false ) ;
24232429 }
24242430
2431+ [ HttpPost ]
2432+ [ ValidateAntiForgeryToken ]
2433+ public ActionResult GetAllPackageVersionsById ( string id )
2434+ {
2435+ return GetAllPackageVersions ( id , version : null ) ;
2436+ }
2437+
2438+ [ HttpPost ]
2439+ [ ValidateAntiForgeryToken ]
2440+ public ActionResult GetAllPackageVersions ( string id , string version )
2441+ {
2442+ if ( ! _featureFlagService . IsReducedVersionListsEnabled ( ) )
2443+ {
2444+ return HttpNotFound ( ) ;
2445+ }
2446+
2447+ if ( string . IsNullOrWhiteSpace ( id ) )
2448+ {
2449+ return new HttpStatusCodeResult ( HttpStatusCode . BadRequest ) ;
2450+ }
2451+
2452+ _telemetryService . TrackFullVersionListLoadRequest ( ) ;
2453+
2454+ string normalized = NuGetVersionFormatter . Normalize ( version ) ;
2455+
2456+ IReadOnlyCollection < Package > allVersions = _packageService . FindPackagesById ( id ,
2457+ includePackageRegistration : true ,
2458+ includeDeprecations : true ,
2459+ includeSupportedFrameworks : true ) ;
2460+
2461+ var filterContext = new PackageFilterContext ( RouteData ? . Route , version ) ;
2462+ var package = _packageFilter . GetFiltered ( allVersions , filterContext ) ;
2463+
2464+ // Validating packages should be hidden to everyone but the owners and admins.
2465+ var currentUser = GetCurrentUser ( ) ;
2466+ if ( package == null
2467+ || ( ( package . PackageStatusKey == PackageStatus . Validating
2468+ || package . PackageStatusKey == PackageStatus . FailedValidation )
2469+ && ActionsRequiringPermissions . DisplayPrivatePackageMetadata . CheckPermissionsOnBehalfOfAnyAccount ( currentUser , package ) != PermissionsCheckResult . Allowed ) )
2470+ {
2471+ return HttpNotFound ( ) ;
2472+ }
2473+
2474+ var isPackageDeprecationEnabled = _featureFlagService . IsManageDeprecationEnabled ( currentUser , allVersions ) ;
2475+ var packageKeyToDeprecation = isPackageDeprecationEnabled
2476+ ? _deprecationService . GetDeprecationsById ( id )
2477+ . GroupBy ( d => d . PackageKey )
2478+ . ToDictionary ( g => g . Key , g => g . First ( ) )
2479+ : null ;
2480+
2481+ var isPackageVulnerabilitiesEnabled = _featureFlagService . IsDisplayVulnerabilitiesEnabled ( ) ;
2482+ var packageKeyToVulnerabilities = isPackageVulnerabilitiesEnabled
2483+ ? _vulnerabilitiesService . GetVulnerabilitiesById ( id )
2484+ : null ;
2485+
2486+ var model = _displayPackageViewModelFactory . Create (
2487+ package ,
2488+ allVersions ,
2489+ currentUser ,
2490+ packageKeyToDeprecation ,
2491+ packageKeyToVulnerabilities ,
2492+ packageRenames : null , // not used in this view
2493+ readmeResult : null ) ; // not used in this view
2494+
2495+ return PartialView ( "_DisplayPackageVersionTable" , model ) ;
2496+ }
2497+
24252498 private async Task < ActionResult > HandleOwnershipRequest (
24262499 string id ,
24272500 string username ,
0 commit comments