diff --git a/ietf/doc/migrations/0007_create_rfc_documents.py b/ietf/doc/migrations/0007_create_rfc_documents.py index 6254c552ec..44d6e9c5e6 100644 --- a/ietf/doc/migrations/0007_create_rfc_documents.py +++ b/ietf/doc/migrations/0007_create_rfc_documents.py @@ -41,10 +41,13 @@ def forward(apps, schema_editor): name=rfc_alias.name, rfc_number=int(rfc_alias.name[3:]), title=draft.title, + stream=draft.stream, + group=draft.group, abstract=draft.abstract, pages=draft.pages, words=draft.words, std_level=draft.std_level, + ad=draft.ad, external_url=draft.external_url, uploaded_filename=draft.uploaded_filename, note=draft.note, diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py index 0ea74e005c..23a9d5aab9 100644 --- a/ietf/doc/views_doc.py +++ b/ietf/doc/views_doc.py @@ -1028,21 +1028,46 @@ def document_history(request, name): add_events_message_info(events) # figure out if the current user can add a comment to the history - if doc.type_id == "draft" and doc.group != None: - can_add_comment = bool(has_role(request.user, ("Area Director", "Secretariat", "IRTF Chair", "IANA", "RFC Editor")) or ( - request.user.is_authenticated and - Role.objects.filter(name__in=("chair", "secr"), - group__acronym=doc.group.acronym, - person__user=request.user))) + if doc.type_id in ("draft", "rfc") and doc.group is not None: + can_add_comment = bool( + has_role( + request.user, + ("Area Director", "Secretariat", "IRTF Chair", "IANA", "RFC Editor"), + ) + or ( + request.user.is_authenticated + and Role.objects.filter( + name__in=("chair", "secr"), + group__acronym=doc.group.acronym, + person__user=request.user, + ) + ) + ) else: - can_add_comment = has_role(request.user, ("Area Director", "Secretariat", "IRTF Chair")) - return render(request, "doc/document_history.html", - dict(doc=doc, - top=top, - diff_revisions=diff_revisions, - events=events, - can_add_comment=can_add_comment, - )) + can_add_comment = has_role( + request.user, ("Area Director", "Secretariat", "IRTF Chair") + ) + + # Get related docs whose history should be linked + if doc.type_id == "draft": + related = doc.related_that_doc("became-rfc") + elif doc.type_id == "rfc": + related = doc.related_that("became-rfc") + else: + related = [] + + return render( + request, + "doc/document_history.html", + { + "doc": doc, + "top": top, + "diff_revisions": diff_revisions, + "events": events, + "related": related, + "can_add_comment": can_add_comment, + }, + ) def document_bibtex(request, name, rev=None): diff --git a/ietf/templates/doc/document_history.html b/ietf/templates/doc/document_history.html index 9c76774b88..91d5d393c0 100644 --- a/ietf/templates/doc/document_history.html +++ b/ietf/templates/doc/document_history.html @@ -11,7 +11,7 @@ - + {% endblock %} {% block content %} {% origin %} @@ -20,7 +20,17 @@

Revision differences

{% include "doc/document_history_form.html" with doc=doc diff_revisions=diff_revisions action=rfcdiff_base_url snapshot=snapshot only %} {% endif %} -

Document history

+

Document history + {% if related %} +
+ {% for related_docalias in related %} + + Related history for {{ related_docalias.name }} + + {% endfor %} +
+ {% endif %}

{% if can_add_comment %}
Document history Date - Rev. + {% if doc.type_id != "rfc" %}Rev.{% endif %} By Action @@ -45,7 +55,7 @@

Document history

{{ e.time|date:"Y-m-d" }}
- {{ e.rev }} + {% if doc.type_id != "rfc" %}{{ e.rev }}{% endif %} {{ e.by|escape }} {{ e.desc|format_history_text }}