Remove the automatic redirect from latest version to page without version number (also from tests), and made sure when viewing old snapshot which also happens to be last revision for draft where we have rfc, we show information from the draft, not from the rfc. Fixes issue #3162. Commit ready for merge.
- Legacy-Id: 18858
This commit is contained in:
parent
cc65d97563
commit
84a25ed491
ietf
|
@ -930,13 +930,21 @@ Man Expires September 22, 2015 [Page 3]
|
|||
doc.rev = "01"
|
||||
doc.save_with_history([DocEvent.objects.create(doc=doc, rev=doc.rev, type="changed_document", by=Person.objects.get(user__username="secretary"), desc="Test")])
|
||||
|
||||
# Fetch the main page resulting latest version
|
||||
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertContains(r, "%s-01"%docname)
|
||||
|
||||
|
||||
# Fetch 01 version even when it is last version
|
||||
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name,rev="01")))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertContains(r, "%s-01"%docname)
|
||||
|
||||
# Fetch version number which is too large, that should redirect to main page
|
||||
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name,rev="02")))
|
||||
self.assertEqual(r.status_code, 302)
|
||||
|
||||
|
||||
# Fetch 00 version which should result that version
|
||||
r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name,rev="00")))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertContains(r, "%s-00"%docname)
|
||||
|
|
|
@ -139,9 +139,6 @@ def document_main(request, name, rev=None):
|
|||
|
||||
gh = None
|
||||
if rev != None:
|
||||
if rev == doc.rev:
|
||||
return redirect('ietf.doc.views_doc.document_main', name=name)
|
||||
|
||||
# find the entry in the history
|
||||
for h in doc.history_set.order_by("-time"):
|
||||
if rev == h.rev:
|
||||
|
@ -210,7 +207,7 @@ def document_main(request, name, rev=None):
|
|||
|
||||
latest_revision = None
|
||||
|
||||
if doc.get_state_slug() == "rfc":
|
||||
if not snapshot and doc.get_state_slug() == "rfc":
|
||||
# content
|
||||
content = doc.text_or_error() # pyflakes:ignore
|
||||
content = markup_txt.markup(maybe_split(content, split=split_content))
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
{% block pagehead %}
|
||||
<link rel="alternate" type="application/atom+xml" title="Document changes" href="/feed/document-changes/{{ name }}/">
|
||||
<meta name="description" content="{{ doc.title }} {% if doc.get_state_slug == "rfc" %}(RFC {{ rfc_number }}{% if published %}, {{ published.time|date:"F Y" }}{% endif %}{% if obsoleted_by %}; obsoleted by {{ obsoleted_by|join:", " }}{% endif %}){% else %}(Internet-Draft, {{ doc.time|date:"Y" }}){% endif %}">
|
||||
<meta name="description" content="{{ doc.title }} {% if doc.get_state_slug == "rfc" and not snapshot %}(RFC {{ rfc_number }}{% if published %}, {{ published.time|date:"F Y" }}{% endif %}{% if obsoleted_by %}; obsoleted by {{ obsoleted_by|join:", " }}{% endif %}){% else %}(Internet-Draft, {{ doc.time|date:"Y" }}){% endif %}">
|
||||
<script src="{% static 'd3/d3.min.js' %}"></script>
|
||||
<script src="{% static 'jquery/jquery.min.js' %}"></script>
|
||||
<script src="{% static 'ietf/js/document_timeline.js' %}"></script>
|
||||
|
@ -18,7 +18,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block title %}
|
||||
{% if doc.get_state_slug == "rfc" %}
|
||||
{% if doc.get_state_slug == "rfc" and not snapshot %}
|
||||
RFC {{ rfc_number }} - {{ doc.title }}
|
||||
{% else %}
|
||||
{{ name }}-{{ doc.rev }} - {{ doc.title }}
|
||||
|
@ -38,7 +38,11 @@
|
|||
{% if doc.rev != latest_rev %}
|
||||
<th colspan="4" class="alert-warning">The information below is for an old version of the document</th>
|
||||
{% else %}
|
||||
<th colspan="4"></th>
|
||||
{% if doc.get_state_slug == "rfc" and snapshot %}
|
||||
<th colspan="4" class="alert-warning">The information below is for an old version of the document that is already published as an RFC</th>
|
||||
{% else %}
|
||||
<th colspan="4"></th>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -49,7 +53,7 @@
|
|||
<th>Type</th>
|
||||
<td class="edit"></td>
|
||||
<td>
|
||||
{% if doc.get_state_slug == "rfc" %}
|
||||
{% if doc.get_state_slug == "rfc" and not snapshot %}
|
||||
RFC - {{ doc.std_level }}
|
||||
({% if published %}{{ published.time|date:"F Y" }}{% else %}publication date unknown{% endif %}{% if has_errata %}; <a href="https://www.rfc-editor.org/errata_search.php?rfc={{ rfc_number }}" rel="nofollow">Errata</a>{% else %}; No errata{% endif %})
|
||||
|
||||
|
@ -170,7 +174,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
{% if doc.get_state_slug != "rfc" %}
|
||||
{% if doc.get_state_slug != "rfc" and not snapshot %}
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Intended RFC status</th>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<ul class="pagination revlist">
|
||||
<li class="disabled"><a><b>Versions</b></a></li>
|
||||
{% for rev in revisions %}
|
||||
<li {% if rev == doc.rev %}{% if rev == latest_rev %}class="active"{% else %}class="warning"{% endif %}{% endif %}>
|
||||
<a href="{% url "ietf.doc.views_doc.document_main" name=doc.name %}{% if not forloop.last %}{{ rev }}/{% endif %}" {% if rev != "00" and rev != latest_rev %}rel="nofollow"{% endif %} >{{ rev }}</a>
|
||||
<li {% if rev == doc.rev %}{% if snapshot or not doc.get_state_slug == "rfc" %}{% if rev == latest_rev and not doc.get_state_slug == "rfc" %}class="active"{% else %}class="warning"{% endif %}{% endif %}{% endif %}>
|
||||
<a href="{% url "ietf.doc.views_doc.document_main" name=doc.name %}{{ rev }}/" {% if rev != "00" and rev != latest_rev %}rel="nofollow"{% endif %} >{{ rev }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue