From 03e52126f30934d07d1ca9c8daec97566e7a5958 Mon Sep 17 00:00:00 2001 From: Adam Roach Date: Sat, 18 Jul 2015 12:18:38 +0000 Subject: [PATCH] Only display 'possibly replaces' information to those people who can approve it and to authors - Legacy-Id: 9786 --- ietf/doc/views_doc.py | 12 +++++- ietf/templates/doc/document_draft.html | 52 +++++++++++++------------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py index 1d73b8ecc..3844504ba 100644 --- a/ietf/doc/views_doc.py +++ b/ietf/doc/views_doc.py @@ -156,6 +156,11 @@ def document_main(request, name, rev=None): person__user=request.user))) can_edit_iana_state = has_role(request.user, ("Secretariat", "IANA")) + can_edit_replaces = has_role(request.user, ("Area Director", "Secretariat", "WG Chair", "RG Chair", "WG Secretary", "RG Secretary")) + + is_author = unicode(request.user) in set([email.address for email in doc.authors.all()]) + can_view_possibly_replaces = can_edit_replaces or is_author + rfc_number = name[3:] if name.startswith("") else None draft_name = None for a in aliases: @@ -357,8 +362,9 @@ def document_main(request, name, rev=None): table_rows = dict(doc=4, stream=2, iesg=4, iana=2, rfced=1) table_rows['doc'] += 1 if replaces or can_edit_stream_info else 0 table_rows['doc'] += 1 if replaced_by else 0 - table_rows['doc'] += 1 if possibly_replaces else 0 - table_rows['doc'] += 1 if possibly_replaced_by else 0 + if can_view_possibly_replaces: + table_rows['doc'] += 1 if possibly_replaces else 0 + table_rows['doc'] += 1 if possibly_replaced_by else 0 table_rows['doc'] += 1 if doc.get_state_slug() != "rfc" else 0 table_rows['doc'] += 1 if conflict_reviews else 0 @@ -390,6 +396,8 @@ def document_main(request, name, rev=None): can_edit_notify=can_edit_notify, can_edit_iana_state=can_edit_iana_state, can_edit_consensus=can_edit_consensus, + can_edit_replaces=can_edit_replaces, + can_view_possibly_replaces=can_view_possibly_replaces, rfc_number=rfc_number, draft_name=draft_name, diff --git a/ietf/templates/doc/document_draft.html b/ietf/templates/doc/document_draft.html index 51bf2f85b..e0f2b890f 100644 --- a/ietf/templates/doc/document_draft.html +++ b/ietf/templates/doc/document_draft.html @@ -94,32 +94,34 @@ {% endif %} - {% if possibly_replaces %} - - Possibly Replaces - - {% if can_edit_stream_info %} - Edit - {% endif %} - - - {{ possibly_replaces|join:", "|urlize_ietf_docs }} - - - {% endif %} + {% if can_view_possibly_replaces %} + {% if possibly_replaces %} + + Possibly Replaces + + {% if can_edit_replaces %} + Edit + {% endif %} + + + {{ possibly_replaces|join:", "|urlize_ietf_docs }} + + + {% endif %} - {% if possibly_replaced_by %} - - Possibly Replaced By - - {% if can_edit_stream_info %} - {% comment %}Edit{% endcomment %} - {% endif %} - - - {{ possibly_replaced_by|join:", "|urlize_ietf_docs }} - - + {% if possibly_replaced_by %} + + Possibly Replaced By + + {% if can_edit_replaces %} + {% comment %}Edit{% endcomment %} + {% endif %} + + + {{ possibly_replaced_by|join:", "|urlize_ietf_docs }} + + + {% endif %} {% endif %}