Skip to content

Commit

Permalink
fix: Correctly display the last pre-RFC rev of a draft
Browse files Browse the repository at this point in the history
  • Loading branch information
pselkirk committed Jan 4, 2024
1 parent bbc64d3 commit 02e0d96
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions ietf/doc/tests.py
Expand Up @@ -840,6 +840,10 @@ def test_document_draft(self):
updated_by = IndividualRfcFactory()
updated_by.relateddocument_set.create(relationship_id='updates',target=rfc)

r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name, rev=draft.rev)))
self.assertEqual(r.status_code, 200)
self.assertContains(r, "This is an older version of an Internet-Draft that was ultimately published as")

r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name)))
self.assertEqual(r.status_code, 302)

Expand Down
4 changes: 2 additions & 2 deletions ietf/templates/doc/document_draft.html
Expand Up @@ -31,7 +31,7 @@
{% if doc.rev != latest_rev %}
<div class="alert alert-warning my-3">The information below is for an old version of the document.</div>
{% else %}
{% if doc.type_id == "rfc" and snapshot %}
{% if doc.became_rfc %}
<div class="alert alert-warning my-3">
The information below is for an old version of the document that is already published as an RFC.
</div>
Expand Down Expand Up @@ -751,7 +751,7 @@
{% endfor %}
{% endif %}
</div>
{% if doc.get_state_slug == "active" or doc.type_id == "rfc" %}
{% if doc.get_state_slug == "active" or doc.type_id == "rfc" or doc.became_rfc %}
<div class="card mt-5">
<div class="card-header">
{% if doc.type_id == "rfc" and not snapshot %}
Expand Down
8 changes: 4 additions & 4 deletions ietf/templates/doc/document_info.html
@@ -1,4 +1,4 @@
{# Copyright The IETF Trust 2016-2020, All Rights Reserved #}
{# Copyright The IETF Trust 2016-2023, All Rights Reserved #}
{% load origin %}
{% load static %}
{% load ietf_filters %}
Expand Down Expand Up @@ -60,8 +60,8 @@
</div>
{% endif %}
{% else %}
{% if snapshot and doc.doc.became_rfc %}
<div{% if document_html %} class="alert alert-warning small"{% endif %}>This is an older version of an Internet-Draft that was ultimately published as <a href="{% if document_html %}{% url 'ietf.doc.views_doc.document_html' name=doc.doc.became_rfc.name %}{% else %}{% url 'ietf.doc.views_doc.document_main' name=doc.doc.became_rfc.name %}{% endif %}">{{doc.doc.became_rfc.name|prettystdname}}</a>.</div>
{% if doc.became_rfc %}
<div{% if document_html %} class="alert alert-warning small"{% endif %}>This is an older version of an Internet-Draft that was ultimately published as <a href="{% if document_html %}{% url 'ietf.doc.views_doc.document_html' name=doc.became_rfc.name %}{% else %}{% url 'ietf.doc.views_doc.document_main' name=doc.became_rfc.name %}{% endif %}">{{doc.became_rfc.name|prettystdname}}</a>.</div>
{% elif snapshot and doc.rev != latest_rev %}
<div{% if document_html %} class="alert alert-warning small"{% endif %}>This is an older version of an Internet-Draft whose latest revision state is "{{ doc.doc.get_state }}".</div>
{% else %}
Expand All @@ -70,7 +70,7 @@
{% if resurrected_by %}- resurrect requested by {{ resurrected_by }}{% endif %}
{% endif %}
{% endif %}
{% if doc.get_state_slug != "active" and doc.type_id != "rfc" %}
{% if doc.get_state_slug != "active" and doc.get_state_slug != "rfc" and doc.type_id != "rfc" %}
<div class="badge rounded-pill text-bg-warning{% if not document_html %} float-end{% endif %}">
Expired &amp; archived
</div>
Expand Down

0 comments on commit 02e0d96

Please sign in to comment.