99
1010from ietf .utils .mail import send_mail , send_mail_text
1111from ietf .ipr .utils import iprs_from_docs , related_docs
12- from ietf .doc .models import WriteupDocEvent , BallotPositionDocEvent , LastCallDocEvent , DocAlias , ConsensusDocEvent , DocTagName
12+ from ietf .doc .models import WriteupDocEvent , BallotPositionDocEvent , LastCallDocEvent , DocAlias , ConsensusDocEvent
1313from ietf .doc .utils import needed_ballot_positions
1414from ietf .person .models import Person
1515from ietf .group .models import Role
1616from ietf .doc .models import Document
17- from ietf .mailtoken .utils import gather_addresses
17+ from ietf .mailtoken .utils import gather_addresses , gather_address_list
1818
1919def email_state_changed (request , doc , text ):
2020 to = [x .strip () for x in doc .notify .replace (';' , ',' ).split (',' )]
@@ -35,7 +35,7 @@ def email_stream_changed(request, doc, old_stream, new_stream, text=""):
3535 streams .append (old_stream .slug )
3636 if new_stream :
3737 streams .append (new_stream .slug )
38- to = gather_addresses ('doc_stream_changed' ,doc = doc ,streams = streams )
38+ to = gather_address_list ('doc_stream_changed' ,doc = doc ,streams = streams )
3939
4040 if not to :
4141 return
@@ -74,6 +74,7 @@ def email_authors(request, doc, subject, text):
7474def html_to_text (html ):
7575 return strip_tags (html .replace ("<" , "<" ).replace (">" , ">" ).replace ("&" , "&" ).replace ("<br>" , "\n " ))
7676
77+ #TODO Expunge this
7778def email_ad (request , doc , ad , changed_by , text , subject = None ):
7879 if not ad or not changed_by or ad == changed_by :
7980 return
@@ -406,7 +407,7 @@ def email_last_call_expired(doc):
406407 text = "IETF Last Call has ended, and the state has been changed to\n %s." % doc .get_state ("draft-iesg" ).name
407408
408409 send_mail (None ,
409- gather_addresses ('last_call_expired' ,doc = doc )
410+ gather_addresses ('last_call_expired' ,doc = doc ),
410411 "DraftTracker Mail System <iesg-secretary@ietf.org>" ,
411412 "Last Call Expired: %s" % doc .file_tag (),
412413 "doc/mail/change_notice.txt" ,
@@ -416,27 +417,8 @@ def email_last_call_expired(doc):
416417 cc = gather_addresses ('last_call_expired_cc' ,doc = doc )
417418 )
418419
419- def stream_state_email_recipients (doc , extra_recipients = []):
420- persons = set ()
421- res = []
422- for r in Role .objects .filter (group = doc .group , name__in = ("chair" , "delegate" )).select_related ("person" , "email" ):
423- res .append (r .formatted_email ())
424- persons .add (r .person )
425-
426- for email in doc .authors .all ():
427- if email .person not in persons :
428- res .append (email .formatted_email ())
429- persons .add (email .person )
430-
431- for e in extra_recipients :
432- if e .person not in persons :
433- res .append (e .formatted_email ())
434- persons .add (e .person )
435-
436- return res
437-
438420def email_stream_state_changed (request , doc , prev_state , new_state , by , comment = "" ):
439- recipients = stream_state_email_recipients ( doc )
421+ recipients = gather_address_list ( 'doc_stream_state_edited' , doc = doc )
440422
441423 state_type = (prev_state or new_state ).type
442424
@@ -452,12 +434,8 @@ def email_stream_state_changed(request, doc, prev_state, new_state, by, comment=
452434 comment = comment ))
453435
454436def email_stream_tags_changed (request , doc , added_tags , removed_tags , by , comment = "" ):
455- extra_recipients = []
456-
457- if DocTagName .objects .get (slug = "sheph-u" ) in added_tags and doc .shepherd :
458- extra_recipients .append (doc .shepherd )
459437
460- recipients = stream_state_email_recipients ( doc , extra_recipients )
438+ recipients = gather_address_list ( 'doc_stream_state_edited' , doc = doc )
461439
462440 send_mail (request , recipients , settings .DEFAULT_FROM_EMAIL ,
463441 u"Tags changed for %s" % doc .name ,
0 commit comments