summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2018-05-03 17:44:11 +0000
committerMagnus Hagander2018-05-03 17:44:11 +0000
commite8eb10d9a766d191f336658d98192dcc7d22410c (patch)
tree0dff8ab348a8da82d972919cef77b49d6ec74bf3
parent1a0c151b9ed5d254abee9073efc674dd788fe6ed (diff)
Don't allow docs comments on unsupported versions
-rw-r--r--pgweb/docs/views.py5
-rw-r--r--templates/docs/docspage.html2
2 files changed, 7 insertions, 0 deletions
diff --git a/pgweb/docs/views.py b/pgweb/docs/views.py
index 033fb83b..a57c47e3 100644
--- a/pgweb/docs/views.py
+++ b/pgweb/docs/views.py
@@ -128,6 +128,11 @@ def manualarchive(request):
@login_required
def commentform(request, itemid, version, filename):
+ v = get_object_or_404(Version, tree=version)
+ if not v.supported:
+ # No docs comments on unsupported versions
+ return HttpResponseRedirect("/docs/{0}/static/{1}".format(version, filename))
+
if request.method == 'POST':
form = DocCommentForm(request.POST)
if form.is_valid():
diff --git a/templates/docs/docspage.html b/templates/docs/docspage.html
index 52544901..3c5535b4 100644
--- a/templates/docs/docspage.html
+++ b/templates/docs/docspage.html
@@ -88,6 +88,7 @@ This page in other versions:
{{page.content|safe}}
</div>
+{%if page.version.supported%}
<div id="docComments">
<h2>Submit correction</h2>
@@ -99,6 +100,7 @@ please use
to report a documentation issue.
</p>
</div>
+{%endif%}
<div id="docFooter">
<a href="{{link_root}}/about/privacypolicy">Privacy Policy</a> |