Repository: ietf-tools/datatracker

Issue:
Remove the IESG Note from the IESG writeups tab
The field for an RFC Editor note has not been used for a long time.
Lets remove it and adjust the places (like email sent) that used it.
cc: @larseggert @evyncke @wkumari


Discussion:
As discussed with @rjsparks, this is about removing the *IESG Note*, **not** the *RFC Editor Note*.

That is kept in `doc.note`, which is also used for notes by other approving bodies (IRTF, IAB, etc.) - should that all go? (I'd think so.)

CC @csperkins @mirjak

Resolving patch:
diff --git a/ietf/doc/urls.py b/ietf/doc/urls.py
--- a/ietf/doc/urls.py
+++ b/ietf/doc/urls.py
@@ -134,7 +134,6 @@
     url(r'^%(name)s/edit/suggested-replaces/$' % settings.URL_REGEXPS, views_draft.review_possibly_replaces),
     url(r'^%(name)s/edit/status/$' % settings.URL_REGEXPS, views_draft.change_intention),
     url(r'^%(name)s/edit/telechat/$' % settings.URL_REGEXPS, views_doc.telechat_date),
-    url(r'^%(name)s/edit/iesgnote/$' % settings.URL_REGEXPS, views_draft.edit_iesg_note),
     url(r'^%(name)s/edit/ad/$' % settings.URL_REGEXPS, views_draft.edit_ad),
     url(r'^%(name)s/edit/authors/$' % settings.URL_REGEXPS, views_doc.edit_authors),
     url(r'^%(name)s/edit/consensus/$' % settings.URL_REGEXPS, views_draft.edit_consensus),
diff --git a/ietf/doc/views_draft.py b/ietf/doc/views_draft.py
--- a/ietf/doc/views_draft.py
+++ b/ietf/doc/views_draft.py
@@ -491,7 +491,6 @@ class EditInfoForm(forms.Form):
         help_text="Separate email addresses with commas.",
         required=False,
     )
-    note = forms.CharField(widget=forms.Textarea, label="IESG note", required=False, strip=False)
     telechat_date = forms.TypedChoiceField(coerce=lambda x: datetime.datetime.strptime(x, '%Y-%m-%d').date(), empty_value=None, required=False, widget=forms.Select(attrs={'onchange':'make_bold()'}))
     returning_item = forms.BooleanField(required=False)
 
@@ -515,9 +514,6 @@ def __init__(self, *args, **kwargs):
         # returning item is rendered non-standard
         self.standard_fields = [x for x in self.visible_fields() if x.name not in ('returning_item',)]
 
-    def clean_note(self):
-        return self.cleaned_data['note'].replace('\r', '').strip()
-
 def to_iesg(request,name):
     """ Submit an IETF stream document to the IESG for publication """ 
     doc = get_object_or_404(Document, docalias__name=name, stream='ietf')
@@ -715,18 +711,6 @@ def diff(attr, name):
             diff('ad', "Responsible AD")
             diff('notify', "State Change Notice email list")
 
-            if r['note'] != doc.note:
-                if not r['note']:
-                    if doc.note:
-                        changes.append("Note field has been cleared")
-                else:
-                    if doc.note:
-                        changes.append("Note changed to '%s'" % r['note'])
-                    else:
-                        changes.append("Note added '%s'" % r['note'])
-                    
-                doc.note = r['note']
-
             if doc.group.type_id in ("individ", "area"):
                 if not r["area"]:
                     r["area"] = Group.objects.get(type="individ")
@@ -769,7 +753,6 @@ def diff(attr, name):
                     area=doc.group_id,
                     ad=doc.ad_id,
                     notify=doc.notify,
-                    note=doc.note,
                     telechat_date=initial_telechat_date,
                     returning_item=initial_returning_item,
                     )
@@ -862,52 +845,6 @@ def restore_draft_file(request, draft):
             log.log("  Exception %s when attempting to move %s" % (ex, file))
 
 
-class IESGNoteForm(forms.Form):
-    note = forms.CharField(widget=forms.Textarea, label="IESG note", required=False, strip=False)
-
-    def clean_note(self):
-        # not munging the database content to use html line breaks --
-        # that has caused a lot of pain in the past.
-        return self.cleaned_data['note'].replace('\r', '').strip()
-
-@role_required("Area Director", "Secretariat")
-def edit_iesg_note(request, name):
-    doc = get_object_or_404(Document, type="draft", name=name)
-    login = request.user.person
-
-    initial = dict(note=doc.note)
-
-    if request.method == "POST":
-        form = IESGNoteForm(request.POST, initial=initial)
-
-        if form.is_valid():
-            new_note = form.cleaned_data['note']
-            if new_note != doc.note:
-                if not new_note:
-                    if doc.note:
-                        log_message = "Note field has been cleared"
-                else:
-                    if doc.note:
-                        log_message = "Note changed to '%s'" % new_note
-                    else:
-                        log_message = "Note added '%s'" % new_note
-
-                c = DocEvent(type="added_comment", doc=doc, rev=doc.rev, by=login)
-                c.desc = log_message
-                c.save()
-
-                doc.note = new_note
-                doc.save_with_history([c])
-
-            return redirect('ietf.doc.views_doc.document_main', name=doc.name)
-    else:
-        form = IESGNoteForm(initial=initial)
-
-    return render(request, 'doc/draft/edit_iesg_note.html',
-                              dict(doc=doc,
-                                   form=form,
-                                   ))
-
 class ShepherdWriteupUploadForm(forms.Form):
     content = forms.CharField(widget=forms.Textarea, label="Shepherd writeup", help_text="Edit the shepherd writeup.", required=False, strip=False)
     txt = forms.FileField(label=".txt format", help_text="Or upload a .txt file.", required=False)
diff --git a/ietf/iesg/views.py b/ietf/iesg/views.py
--- a/ietf/iesg/views.py
+++ b/ietf/iesg/views.py
@@ -142,8 +142,6 @@ def agenda_json(request, date=None):
                     'ad':doc.ad.name if doc.ad else None,
                     }
 
-                if doc.note:
-                    docinfo['note'] = doc.note
                 defer = doc.active_defer_event()
                 if defer:
                     docinfo['defer-by'] = defer.by.name


Test patch:
diff --git a/ietf/doc/tests.py b/ietf/doc/tests.py
--- a/ietf/doc/tests.py
+++ b/ietf/doc/tests.py
@@ -828,7 +828,7 @@ def test_document_draft(self):
             stream_id=draft.stream_id, group_id=draft.group_id, abstract=draft.abstract,stream=draft.stream, rev=draft.rev,
             pages=draft.pages, intended_std_level_id=draft.intended_std_level_id,
             shepherd_id=draft.shepherd_id, ad_id=draft.ad_id, expires=draft.expires,
-            notify=draft.notify, note=draft.note)
+            notify=draft.notify)
         rel = RelatedDocument.objects.create(source=replacement,
                                              target=draft.docalias.get(name__startswith="draft"),
                                              relationship_id="replaces")
diff --git a/ietf/doc/tests_draft.py b/ietf/doc/tests_draft.py
--- a/ietf/doc/tests_draft.py
+++ b/ietf/doc/tests_draft.py
@@ -362,16 +362,14 @@ def test_edit_info(self):
                                   stream=draft.stream_id,
                                   ad=str(new_ad.pk),
                                   notify="test@example.com",
-                                  note="New note",
                                   telechat_date="",
                                   ))
         self.assertEqual(r.status_code, 302)
 
         draft = Document.objects.get(name=draft.name)
         self.assertEqual(draft.ad, new_ad)
-        self.assertEqual(draft.note, "New note")
         self.assertTrue(not draft.latest_event(TelechatDocEvent, type="scheduled_for_telechat"))
-        self.assertEqual(draft.docevent_set.count(), events_before + 3)
+        self.assertEqual(draft.docevent_set.count(), events_before + 2)
         self.assertEqual(len(outbox), mailbox_before + 1)
         self.assertTrue(draft.name in outbox[-1]['Subject'])
 
@@ -386,7 +384,6 @@ def test_edit_telechat_date(self):
                     stream=draft.stream_id,
                     ad=str(draft.ad_id),
                     notify=draft.notify,
-                    note="",
                     )
 
         # get
@@ -489,7 +486,6 @@ def test_start_iesg_process_on_draft(self):
                                   ad=ad.pk,
                                   create_in_state=State.objects.get(used=True, type="draft-iesg", slug="watching").pk,
                                   notify="test@example.com",
-                                  note="This is a note",
                                   telechat_date="",
                                   ))
         self.assertEqual(r.status_code, 302)
@@ -497,12 +493,11 @@ def test_start_iesg_process_on_draft(self):
         draft = Document.objects.get(name=draft.name)
         self.assertEqual(draft.get_state_slug("draft-iesg"), "watching")
         self.assertEqual(draft.ad, ad)
-        self.assertEqual(draft.note, "This is a note")
         self.assertTrue(not draft.latest_event(TelechatDocEvent, type="scheduled_for_telechat"))
-        self.assertEqual(draft.docevent_set.count(), events_before + 5)
+        self.assertEqual(draft.docevent_set.count(), events_before + 4)
         self.assertCountEqual(draft.action_holders.all(), [draft.ad])
         events = list(draft.docevent_set.order_by('time', 'id'))
-        self.assertEqual(events[-5].type, "started_iesg_process")
+        self.assertEqual(events[-4].type, "started_iesg_process")
         self.assertEqual(len(outbox), mailbox_before+1)
         self.assertTrue('IESG processing' in outbox[-1]['Subject'])
         self.assertTrue('draft-ietf-mars-test2@' in outbox[-1]['To']) 
@@ -518,7 +513,6 @@ def test_start_iesg_process_on_draft(self):
                                   ad=ad.pk,
                                   create_in_state=State.objects.get(used=True, type="draft-iesg", slug="pub-req").pk,
                                   notify="test@example.com",
-                                  note="This is a note",
                                   telechat_date="",
                                   ))
         self.assertEqual(r.status_code, 302)
@@ -1043,23 +1037,6 @@ def test_doc_change_telechat_date(self):
         doc = Document.objects.get(name=self.docname)
         self.assertEqual(doc.latest_event(TelechatDocEvent, "scheduled_for_telechat").telechat_date,None)
         
-    def test_doc_change_iesg_note(self):
-        url = urlreverse('ietf.doc.views_draft.edit_iesg_note', kwargs=dict(name=self.docname))
-        login_testing_unauthorized(self, "secretary", url)
-
-        # get
-        r = self.client.get(url)
-        self.assertEqual(r.status_code,200)
-        q = PyQuery(r.content)
-        self.assertEqual(len(q('[type=submit]:contains("Save")')),1)
-
-        # post
-        r = self.client.post(url,dict(note='ZpyQFGmA\r\nZpyQFGmA'))
-        self.assertEqual(r.status_code,302)
-        doc = Document.objects.get(name=self.docname)
-        self.assertEqual(doc.note,'ZpyQFGmA\nZpyQFGmA')
-        self.assertTrue('ZpyQFGmA' in doc.latest_event(DocEvent,type='added_comment').desc)
-
     def test_doc_change_ad(self):
         url = urlreverse('ietf.doc.views_draft.edit_ad', kwargs=dict(name=self.docname))
         login_testing_unauthorized(self, "secretary", url)
diff --git a/ietf/submit/tests.py b/ietf/submit/tests.py
--- a/ietf/submit/tests.py
+++ b/ietf/submit/tests.py
@@ -355,7 +355,6 @@ def submit_new_wg(self, formats):
             ad=draft.ad,
             expires=timezone.now() + datetime.timedelta(days=settings.INTERNET_DRAFT_DAYS_TO_EXPIRE),
             notify="aliens@example.mars",
-            note="",
         )
         sug_replaced_draft.set_state(State.objects.get(used=True, type="draft", slug="active"))
         sug_replaced_alias = DocAlias.objects.create(name=sug_replaced_draft.name)
@@ -1413,7 +1412,6 @@ def test_edit_submission_and_force_post(self):
             "submitter-name": "Some Random Test Person",
             "submitter-email": "random@example.com",
             "replaces": [str(draft.docalias.first().pk)],
-            "edit-note": "no comments",
             "authors-0-name": "Person 1",
             "authors-0-email": "person1@example.com",
             "authors-1-name": "Person 2",
@@ -1429,7 +1427,6 @@ def test_edit_submission_and_force_post(self):
         self.assertEqual(submission.document_date, document_date)
         self.assertEqual(submission.abstract, "some abstract")
         self.assertEqual(submission.pages, 123)
-        self.assertEqual(submission.note, "no comments")
         self.assertEqual(submission.submitter, "Some Random Test Person <random@example.com>")
         self.assertEqual(submission.replaces, draft.docalias.first().name)
         self.assertEqual(submission.state_id, "manual")
diff --git a/ietf/utils/test_data.py b/ietf/utils/test_data.py
--- a/ietf/utils/test_data.py
+++ b/ietf/utils/test_data.py
@@ -306,7 +306,6 @@ def make_test_data():
         ad=ad,
         expires=timezone.now() + datetime.timedelta(days=settings.INTERNET_DRAFT_DAYS_TO_EXPIRE),
         notify="aliens@example.mars",
-        note="",
         )
 
     draft.set_state(State.objects.get(used=True, type="draft", slug="active"))