diff --git a/ietf/doc/mails.py b/ietf/doc/mails.py index 73627baa8..75ef27638 100644 --- a/ietf/doc/mails.py +++ b/ietf/doc/mails.py @@ -243,6 +243,9 @@ def generate_publication_request(request, doc): approving_body = str(doc.stream) consensus_body = approving_body + e = doc.latest_event(WriteupDocEvent, type="changed_rfc_editor_note_text") + rfcednote = e.text if e else "" + return render_to_string("doc/mail/publication_request.txt", dict(doc=doc, doc_url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(), @@ -250,6 +253,7 @@ def generate_publication_request(request, doc): approving_body=approving_body, consensus_body=consensus_body, consensus=consensus, + rfc_editor_note=rfcednote, ) ) diff --git a/ietf/doc/models.py b/ietf/doc/models.py index ced0d7043..b6639d8a1 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -234,7 +234,10 @@ class DocumentInfo(models.Model): def has_rfc_editor_note(self): e = self.latest_event(WriteupDocEvent, type="changed_rfc_editor_note_text") - return bool(e and (e.text != "")) + if e and (e.text != ""): + return e.time + else: + return False def meeting_related(self): answer = False diff --git a/ietf/doc/tests_ballot.py b/ietf/doc/tests_ballot.py index ecf4af059..68f4b4887 100644 --- a/ietf/doc/tests_ballot.py +++ b/ietf/doc/tests_ballot.py @@ -421,15 +421,49 @@ class BallotWriteupsTests(TestCase): e.text = u"Test note to the RFC Editor text." e.save() + # IETF Stream Documents for p in ['doc_ballot_approvaltext','doc_ballot_writeupnotes','doc_ballot_rfceditornote']: url = urlreverse(p, kwargs=dict(name=draft.name)) - for username in ['plain','marschairman','iana','iab chair']: + for username in ['plain','marschairman','iab chair','irtf chair','ise','iana']: verify_fail(username, url) for username in ['secretary','ad']: verify_can_see(username, url) + # RFC Editor Notes for documents in the IAB Stream + draft.stream_id = 'iab' + draft.save() + url = urlreverse('doc_ballot_rfceditornote', kwargs=dict(name=draft.name)) + + for username in ['plain','marschairman','ad','irtf chair','ise','iana']: + verify_fail(username, url) + + for username in ['secretary','iab chair']: + verify_can_see(username, url) + + # RFC Editor Notes for documents in the IRTF Stream + draft.stream_id = 'irtf' + draft.save() + url = urlreverse('doc_ballot_rfceditornote', kwargs=dict(name=draft.name)) + + for username in ['plain','marschairman','ad','iab chair','ise','iana']: + verify_fail(username, url) + + for username in ['secretary','irtf chair']: + verify_can_see(username, url) + + # RFC Editor Notes for documents in the IAB Stream + draft.stream_id = 'ise' + draft.save() + url = urlreverse('doc_ballot_rfceditornote', kwargs=dict(name=draft.name)) + + for username in ['plain','marschairman','ad','iab chair','irtf chair','iana']: + verify_fail(username, url) + + for username in ['secretary','ise']: + verify_can_see(username, url) + class ApproveBallotTests(TestCase): def test_approve_ballot(self): draft = make_test_data() diff --git a/ietf/doc/views_ballot.py b/ietf/doc/views_ballot.py index 8053212e4..790bf0874 100644 --- a/ietf/doc/views_ballot.py +++ b/ietf/doc/views_ballot.py @@ -23,7 +23,7 @@ from ietf.doc.mails import ( email_ballot_deferred, email_ballot_undeferred, generate_approval_mail ) from ietf.doc.lastcall import request_last_call from ietf.iesg.models import TelechatDate -from ietf.ietfauth.utils import has_role, role_required +from ietf.ietfauth.utils import has_role, role_required, is_authorized_in_doc_stream from ietf.message.utils import infer_message from ietf.name.models import BallotPositionName from ietf.person.models import Person @@ -592,15 +592,16 @@ class BallotRfcEditorNoteForm(forms.Form): def clean_rfc_editor_note(self): return self.cleaned_data["rfc_editor_note"].replace("\r", "") -@role_required('Area Director','Secretariat') +@role_required('Area Director','Secretariat','IAB Chair','IRTF Chair','ISE') def ballot_rfceditornote(request, name): - """Editing of RFC Editor Note in the ballot""" + """Editing of RFC Editor Note""" doc = get_object_or_404(Document, docalias__name=name) + if not is_authorized_in_doc_stream(request.user, doc): + return HttpResponseForbidden("You do not have the necessary permissions to change the RFC Editor Note for this document") + login = request.user.person - - existing = doc.latest_event(WriteupDocEvent, type="changed_rfc_editor_note_text") if not existing or (existing.text == ""): existing = generate_ballot_rfceditornote(request, doc) diff --git a/ietf/templates/doc/ballot/rfceditornote.html b/ietf/templates/doc/ballot/rfceditornote.html index 8555e1fe0..53e029351 100644 --- a/ietf/templates/doc/ballot/rfceditornote.html +++ b/ietf/templates/doc/ballot/rfceditornote.html @@ -4,12 +4,12 @@ {% load bootstrap3 %} -{% block title %}RFC Editor Note for ballot for {{ doc }}{% endblock %} +{% block title %}RFC Editor Note for {{ doc }}{% endblock %} {% block content %} {% origin %} -