From 02e0d960a40741915475ddd9d0c39cbb1aa235c2 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Thu, 4 Jan 2024 00:50:08 -0500 Subject: [PATCH] fix: Correctly display the last pre-RFC rev of a draft --- ietf/doc/tests.py | 4 ++++ ietf/templates/doc/document_draft.html | 4 ++-- ietf/templates/doc/document_info.html | 8 ++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ietf/doc/tests.py b/ietf/doc/tests.py index 0b5a651060..63953876aa 100644 --- a/ietf/doc/tests.py +++ b/ietf/doc/tests.py @@ -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) diff --git a/ietf/templates/doc/document_draft.html b/ietf/templates/doc/document_draft.html index 6eeacfc387..8d9abf284f 100644 --- a/ietf/templates/doc/document_draft.html +++ b/ietf/templates/doc/document_draft.html @@ -31,7 +31,7 @@ {% if doc.rev != latest_rev %}
The information below is for an old version of the document.
{% else %} - {% if doc.type_id == "rfc" and snapshot %} + {% if doc.became_rfc %}
The information below is for an old version of the document that is already published as an RFC.
@@ -751,7 +751,7 @@ {% endfor %} {% endif %} - {% 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 %}
{% if doc.type_id == "rfc" and not snapshot %} diff --git a/ietf/templates/doc/document_info.html b/ietf/templates/doc/document_info.html index 61b1574337..21591564b8 100644 --- a/ietf/templates/doc/document_info.html +++ b/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 %} @@ -60,8 +60,8 @@
{% endif %} {% else %} - {% if snapshot and doc.doc.became_rfc %} - This is an older version of an Internet-Draft that was ultimately published as {{doc.doc.became_rfc.name|prettystdname}}.
+ {% if doc.became_rfc %} + This is an older version of an Internet-Draft that was ultimately published as {{doc.became_rfc.name|prettystdname}}. {% elif snapshot and doc.rev != latest_rev %} This is an older version of an Internet-Draft whose latest revision state is "{{ doc.doc.get_state }}". {% else %} @@ -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" %}
Expired & archived