diff --git a/ietf/doc/utils.py b/ietf/doc/utils.py index d446ddf7b..85ce0f0da 100644 --- a/ietf/doc/utils.py +++ b/ietf/doc/utils.py @@ -936,6 +936,8 @@ def make_rev_history(doc): if document not in predecessors: predecessors.append(document) predecessors.extend(get_predecessors(document, predecessors)) + if doc.came_from_draft(): + predecessors.append(doc.came_from_draft()) return predecessors def get_ancestors(doc, ancestors = None): @@ -946,6 +948,8 @@ def make_rev_history(doc): if document not in ancestors: ancestors.append(document) ancestors.extend(get_ancestors(document, ancestors)) + if doc.became_rfc(): + ancestors.append(doc.became_rfc()) return ancestors def get_replaces_tree(doc): @@ -971,6 +975,9 @@ def make_rev_history(doc): history[url]['pages'] = d.history_set.filter(rev=e.newrevisiondocevent.rev).first().pages if doc.type_id == "draft": + # Do nothing - all draft revisions are captured above already. + e = None + elif doc.type_id == "rfc": # e.time.date() agrees with RPC publication date when shown in the RPC_TZINFO time zone e = doc.latest_event(type='published_rfc') else: @@ -983,7 +990,7 @@ def make_rev_history(doc): 'published': e.time.isoformat(), 'url': url } - if hasattr(e, 'newrevisiondocevent') and doc.history_set.filter(rev=e.newrevisiondocevent.rev).exists(): + if doc.type_id != "rfc" and hasattr(e, 'newrevisiondocevent') and doc.history_set.filter(rev=e.newrevisiondocevent.rev).exists(): history[url]['pages'] = doc.history_set.filter(rev=e.newrevisiondocevent.rev).first().pages history = list(history.values()) return sorted(history, key=lambda x: x['published']) diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py index ae1d32ffa..313aede4e 100644 --- a/ietf/doc/views_doc.py +++ b/ietf/doc/views_doc.py @@ -1649,8 +1649,6 @@ def document_json(request, name, rev=None): data["expires"] = doc.expires.strftime("%Y-%m-%d %H:%M:%S") if doc.expires else None data["title"] = doc.title data["abstract"] = doc.abstract - # Preserve aliases in this api? What about showing rfc_number directly? - data["aliases"] = list(doc.name) data["state"] = extract_name(doc.get_state()) data["intended_std_level"] = extract_name(doc.intended_std_level) data["std_level"] = extract_name(doc.std_level) @@ -1666,7 +1664,7 @@ def document_json(request, name, rev=None): latest_revision = doc.latest_event(NewRevisionDocEvent, type="new_revision") data["rev_history"] = make_rev_history(latest_revision.doc if latest_revision else doc) - if doc.type_id == "draft": + if doc.type_id == "draft": # These live only on drafts data["iesg_state"] = extract_name(doc.get_state("draft-iesg")) data["rfceditor_state"] = extract_name(doc.get_state("draft-rfceditor")) data["iana_review_state"] = extract_name(doc.get_state("draft-iana-review")) @@ -1675,6 +1673,8 @@ def document_json(request, name, rev=None): if doc.stream_id in ("ietf", "irtf", "iab"): e = doc.latest_event(ConsensusDocEvent, type="changed_consensus") data["consensus"] = e.consensus if e else None + + if doc.type_id in ["draft", "rfc"]: data["stream"] = extract_name(doc.stream) return HttpResponse(json.dumps(data, indent=2), content_type='application/json') diff --git a/ietf/templates/doc/document_rfc.html b/ietf/templates/doc/document_rfc.html index d16aa9e92..36c9babd7 100644 --- a/ietf/templates/doc/document_rfc.html +++ b/ietf/templates/doc/document_rfc.html @@ -22,7 +22,7 @@ {% block content %} {% origin %} {{ top|safe }} -
+
{% include "doc/document_info.html" %} diff --git a/ietf/templates/doc/document_statement.html b/ietf/templates/doc/document_statement.html index 1d743b067..79ea305cd 100644 --- a/ietf/templates/doc/document_statement.html +++ b/ietf/templates/doc/document_statement.html @@ -9,7 +9,7 @@ {% origin %} {{ top|safe }} {% include "doc/revisions_list.html" %} -
+
{% if doc.rev != latest_rev %}
The information below is for an older version of this statement.
{% endif %}