Ensure all release notes are accessible from "devel"
authorJonathan S. Katz <jonathan.katz@excoventures.com>
Wed, 30 Oct 2019 23:50:22 +0000 (19:50 -0400)
committerJonathan S. Katz <jonathan.katz@excoventures.com>
Wed, 30 Oct 2019 23:50:22 +0000 (19:50 -0400)
When a new PostgreSQL branch is created, any "devel" notes for that branch
become immediately unavailable, which would make any shared devel links around
that dead.

This adjusts this logic such that any release notes for a release, beta or
otherwise, is now available by redirect the user to the release notes' permanent
home.

Reported By: Andres Freund <andres@anarazel.de>, who also mostly authored the
patch over email.

pgweb/docs/views.py

index 1480903cf82229461b9e909c9829e8ad9aff87b7..5b8afc5b1b09b43a5717925f8c3472a006d8ef67 100644 (file)
@@ -76,14 +76,15 @@ def docpage(request, version, filename):
         if release_version >= Decimal('10'):
             release_version = release_version.quantize(Decimal('1'), rounding=ROUND_DOWN)
         # if these are developer docs (i.e. from the nightly build), we need to
-        # determine if these are release notes for a released version or not, i.e. if we are:
+        # determine if these are release notes for a branched version or not,
+        # i.e. if we are:
         # a) viewing the docs for a version that does not exist yet (e.g. active
         #    development before an initial beta) OR
-        # b) viewing the docs for a beta version
-        is_released = Version.objects.filter(tree=release_version, testing=0).exists() if version == "devel" else True
+        # b) viewing the docs for a beta, RC, or fully released version
+        is_branched = Version.objects.filter(tree=release_version).exists() if version == "devel" else True
         # If we are viewing a released version of the release notesand the
         # release versions do not match, then we redirect
-        if is_released and release_version != ver:
+        if is_branched and release_version != ver:
             url = "/docs/"
             if release_version >= Decimal('10'):
                 url += "{}/{}".format(int(release_version), fullname)