Skip to content

Commit 0c97949

Browse files
committed
Fix messing documentationCandidates
1 parent 8cd0dc7 commit 0c97949

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/Distribution/Server/Features/Documentation.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,14 @@ documentationFeature name
156156
, guardValidPackageId
157157
, corePackagePage
158158
, corePackagesPage
159+
, lookupPackageName
159160
}
160161
getPackages
161162
UploadFeature{..}
162163
TarIndexCacheFeature{cachedTarIndex}
163164
ReportsFeature{..}
164165
UserFeature{ guardAuthorised_ }
165-
VersionsFeature
166-
{ queryGetPreferredInfo
167-
, withPackagePreferred
168-
}
166+
VersionsFeature{queryGetPreferredInfo}
169167
documentationState
170168
documentationChangeHook
171169
= DocumentationFeature{..}
@@ -391,7 +389,8 @@ documentationFeature name
391389

392390
case pkgVersion pkgid == nullVersion of
393391
-- if no version is given we want to redirect to the latest version with docs
394-
True -> withPackagePreferred pkgid $ \_ pkgs -> do
392+
True -> do
393+
pkgs <- lookupPackageName (pkgName pkgid)
395394
prefInfo <- queryGetPreferredInfo (pkgName pkgid)
396395
findLastVerWithDoc queryHasDocumentation prefInfo pkgs >>= \case
397396
Just (latestWithDocs, _) -> do
@@ -454,7 +453,7 @@ findLastVerWithDoc queryHasDoc prefInfo ps = helper (reverse ps)
454453
helper (pkg:pkgs) = do
455454
hasDoc <- queryHasDoc (pkgInfoId pkg)
456455
let status = getVersionStatus prefInfo (packageVersion pkg)
457-
if hasDoc && status /= DeprecatedVersion
456+
if hasDoc && status == NormalVersion
458457
then pure (Just (packageId pkg, status))
459458
else helper pkgs
460459

src/Distribution/Server/Features/Html.hs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -593,15 +593,6 @@ mkHtmlCore ServerEnv{serverBaseURI, serverBlobStore}
593593
pkgdesc = flattenPackageDescription $ pkgDesc pkg
594594

595595
prefInfo <- queryGetPreferredInfo pkgname
596-
597-
-- let findLastDocVer [] = pure Nothing
598-
-- findLastDocVer (pkg':pkgs') = do
599-
-- hasDoc <- queryHasDocumentation documentationFeature (pkgInfoId pkg')
600-
-- let status = getVersionStatus prefInfo (packageVersion pkg')
601-
-- if hasDoc && status /= DeprecatedVersion
602-
-- then pure (Just (packageVersion pkg', status))
603-
-- else findLastDocVer pkgs'
604-
605596
distributions <- queryPackageStatus pkgname
606597
totalDown <- cmFind pkgname `liftM` totalPackageDownloads
607598
recentDown <- cmFind pkgname `liftM` recentPackageDownloads
@@ -614,7 +605,7 @@ mkHtmlCore ServerEnv{serverBaseURI, serverBlobStore}
614605
deprs <- queryGetDeprecatedFor pkgname
615606
mreadme <- makeReadme render
616607
hasDocs <- queryHasDocumentation documentationFeature realpkg
617-
lastVerWithDoc<- findLastVerWithDoc (queryHasDocumentation documentationFeature) prefInfo (reverse pkgs)
608+
lastVerWithDoc<- findLastVerWithDoc (queryHasDocumentation documentationFeature) prefInfo pkgs
618609
rptStats <- queryLastReportStats reportsFeature realpkg
619610
candidates <- lookupCandidateName pkgname
620611
buildStatus <- renderBuildStatus

0 commit comments

Comments
 (0)