Skip to content

Commit 704589b

Browse files
committed
Merged in branch/iola/people-cleanup @ [8471] from olau@iola.dk, which
enhances a number of pages in the datatracker where forms contain fields where a person should be chosen, such as for instance when choosing the shepherd of a document, so that they uniformly display choices which show both email address and name. Furthermore, changes have been made so as to make the email address uniformly act as reference to the person record. Autocompletion is now consistently provided when looking for the email address or name of the person to choose. This solves a number of issues where it has been difficult to choose the correct Person/Email combination, and where the correct email address to use for an association has been unavailable previously. - Legacy-Id: 8472 Note: SVN reference [8471] has been migrated to Git commit d62f234
2 parents d62f234 + 5b7258a commit 704589b

47 files changed

Lines changed: 1658 additions & 286 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

changelog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ietfdb (5.7.0) ietf; urgency=medium
1515
correct Person/Email combination, and where the correct email address to use
1616
for an association has been unavailable previously.
1717

18-
-- Henrik Levkowetz <henrik@levkowetz.com> 25 Oct 2014 13:53:37 -0700
18+
-- Henrik Levkowetz <henrik@levkowetz.com> 25 Oct 2014 13:49:49 -0200
1919

2020
ietfdb (5.6.5) ietf; urgency=medium
2121

ietf/community/rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class ShepherdRule(RuleManager):
8989
description = 'All I-Ds with a particular document shepherd'
9090

9191
def get_documents(self):
92-
return Document.objects.filter(type='draft', states__slug='active').filter(shepherd__name__icontains=self.value).distinct()
92+
return Document.objects.filter(type='draft', states__slug='active').filter(shepherd__person__name__icontains=self.value).distinct()
9393

9494

9595
# class ReferenceToRFCRule(RuleManager):

ietf/doc/mails.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ def email_stream_changed(request, doc, old_stream, new_stream, text=""):
3232

3333
# These use comprehension to deal with conditions when there might be more than one chair listed for a stream
3434
if old_stream:
35-
to.extend([x.person.formatted_email() for x in Role.objects.filter(group__acronym=old_stream.slug,name='chair')])
35+
to.extend([r.formatted_email() for r in Role.objects.filter(group__acronym=old_stream.slug, name='chair')])
3636
if new_stream:
37-
to.extend([x.person.formatted_email() for x in Role.objects.filter(group__acronym=new_stream.slug,name='chair')])
37+
to.extend([r.formatted_email() for r in Role.objects.filter(group__acronym=new_stream.slug, name='chair')])
3838

3939
if not to:
4040
return
@@ -443,10 +443,10 @@ def stream_state_email_recipients(doc, extra_recipients=[]):
443443
res.append(email.formatted_email())
444444
persons.add(email.person)
445445

446-
for p in extra_recipients:
447-
if not p in persons:
448-
res.append(p.formatted_email())
449-
persons.add(p)
446+
for e in extra_recipients:
447+
if e.person not in persons:
448+
res.append(e.formatted_email())
449+
persons.add(e.person)
450450

451451
return res
452452

ietf/doc/migrations/0021_auto__add_field_document_shepherd_email__add_field_dochistory_shepherd.py

Lines changed: 380 additions & 0 deletions
Large diffs are not rendered by default.

ietf/doc/migrations/0022_fill_in_shepherd_email.py

Lines changed: 377 additions & 0 deletions
Large diffs are not rendered by default.

ietf/doc/migrations/0023_auto__del_field_document_shepherd__rename_shepherd_email.py

Lines changed: 375 additions & 0 deletions
Large diffs are not rendered by default.

ietf/doc/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class DocumentInfo(models.Model):
6464
intended_std_level = models.ForeignKey(IntendedStdLevelName, verbose_name="Intended standardization level", blank=True, null=True)
6565
std_level = models.ForeignKey(StdLevelName, verbose_name="Standardization level", blank=True, null=True)
6666
ad = models.ForeignKey(Person, verbose_name="area director", related_name='ad_%(class)s_set', blank=True, null=True)
67-
shepherd = models.ForeignKey(Person, related_name='shepherd_%(class)s_set', blank=True, null=True)
67+
shepherd = models.ForeignKey(Email, related_name='shepherd_%(class)s_set', blank=True, null=True)
6868
expires = models.DateTimeField(blank=True, null=True)
6969
notify = models.CharField(max_length=255, blank=True)
7070
external_url = models.URLField(blank=True) # Should be set for documents with type 'External'.

ietf/doc/tests_draft.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,9 @@ def test_doc_change_ad(self):
819819
self.assertTrue(self.doc.latest_event(DocEvent,type="added_comment").desc.startswith('Shepherding AD changed'))
820820

821821
def test_doc_change_shepherd(self):
822+
self.doc.shepherd = None
823+
self.doc.save()
824+
822825
url = urlreverse('doc_edit_shepherd',kwargs=dict(name=self.docname))
823826

824827
login_testing_unauthorized(self, "plain", url)
@@ -835,23 +838,51 @@ def test_doc_change_shepherd(self):
835838
self.assertEqual(len(q('form input[id=id_shepherd]')),1)
836839

837840
# change the shepherd
838-
plain = Person.objects.get(name='Plain Man')
839-
plain_email = plain.email_set.all()[0]
840-
r = self.client.post(url,dict(shepherd=plain_email))
841+
plain_email = Email.objects.get(person__name="Plain Man")
842+
r = self.client.post(url, dict(shepherd=plain_email.pk))
841843
self.assertEqual(r.status_code,302)
842844
self.doc = Document.objects.get(name=self.docname)
843-
self.assertEqual(self.doc.shepherd,plain)
845+
self.assertEqual(self.doc.shepherd, plain_email)
844846
comments = '::'.join([x.desc for x in self.doc.docevent_set.filter(time=self.doc.time,type="added_comment")])
845847
self.assertTrue('Document shepherd changed to Plain Man' in comments)
846848
self.assertTrue('Notification list changed' in comments)
847849

850+
# test buggy change
848851
ad = Person.objects.get(name='Aread Irector')
849852
two_answers = "%s,%s" % (plain_email, ad.email_set.all()[0])
850-
r = self.client.post(url,(dict(shepherd=two_answers)))
851-
self.assertEqual(r.status_code,200)
853+
r = self.client.post(url, dict(shepherd=two_answers))
854+
self.assertEqual(r.status_code, 200)
852855
q = PyQuery(r.content)
853856
self.assertTrue(len(q('form ul.errorlist')) > 0)
854857

858+
def test_doc_change_shepherd_email(self):
859+
self.doc.shepherd = None
860+
self.doc.save()
861+
862+
url = urlreverse('doc_change_shepherd_email',kwargs=dict(name=self.docname))
863+
r = self.client.get(url)
864+
self.assertEqual(r.status_code, 404)
865+
866+
self.doc.shepherd = Email.objects.get(person__user__username="ad1")
867+
self.doc.save()
868+
869+
login_testing_unauthorized(self, "plain", url)
870+
871+
self.doc.shepherd = Email.objects.get(person__user__username="plain")
872+
self.doc.save()
873+
874+
new_email = Email.objects.create(address="anotheremail@example.com", person=self.doc.shepherd.person)
875+
876+
r = self.client.get(url)
877+
self.assertEqual(r.status_code, 200)
878+
879+
# change the shepherd email
880+
r = self.client.post(url, dict(shepherd=new_email))
881+
self.assertEqual(r.status_code, 302)
882+
self.doc = Document.objects.get(name=self.docname)
883+
self.assertEqual(self.doc.shepherd, new_email)
884+
self.assertTrue(self.doc.latest_event(DocEvent, type="added_comment").desc.startswith('Document shepherd email changed'))
885+
855886
def test_doc_view_shepherd_writeup(self):
856887
url = urlreverse('doc_shepherd_writeup',kwargs=dict(name=self.docname))
857888

ietf/doc/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/ad/$', views_draft.edit_ad, name='doc_change_ad'),
8282
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/consensus/$', views_draft.edit_consensus, name='doc_edit_consensus'),
8383
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/shepherd/$', views_draft.edit_shepherd, name='doc_edit_shepherd'),
84+
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/shepherdemail/$', views_draft.change_shepherd_email, name='doc_change_shepherd_email'),
8485
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/shepherdwriteup/$', views_draft.edit_shepherd_writeup, name='doc_edit_shepherd_writeup'),
8586
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/requestpublication/$', views_draft.request_publication, name='doc_request_publication'),
8687
url(r'^(?P<name>[A-Za-z0-9._+-]+)/edit/adopt/$', views_draft.adopt_draft, name='doc_adopt_draft'),

ietf/doc/views_conflict_review.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def start_review_sanity_check(request, name):
366366
def build_notify_addresses(doc_to_review):
367367
# Take care to do the right thing during ietf chair and stream owner transitions
368368
notify_addresses = []
369-
notify_addresses.extend([x.person.formatted_email() for x in Role.objects.filter(group__acronym=doc_to_review.stream.slug,name='chair')])
369+
notify_addresses.extend([r.formatted_email() for r in Role.objects.filter(group__acronym=doc_to_review.stream.slug, name='chair')])
370370
notify_addresses.append("%s@%s" % (doc_to_review.name, settings.TOOLS_SERVER))
371371
return notify_addresses
372372

0 commit comments

Comments
 (0)