Done with the first pass instrumenting all mail points. There is one spot in the ipr code that's complicated and will require some refactor before instrumenting. There are a few places to add explicit messages (templates and all) to replace the simple use of email_ad. The next pass will be to make sure every spot that sends mail is covered by a test, and that the tests look at the headers sensibly. That will be followed by a moderately heavy refactor of MailToken and the gather_address utilities. Then pages showing the expansions of a token for a given document/group. Long way to go, but this is working well, and I think it will make things much easier later.
- Legacy-Id: 10030
This commit is contained in:
parent
5db9e0d6a8
commit
65be4190a7
|
@ -25,9 +25,13 @@ def make_recipients(apps):
|
|||
desc='The Secretariat',
|
||||
template='<iesg-secretary@ietf.org>')
|
||||
|
||||
rc(slug='ietf_secretariat',
|
||||
desc='The Secretariat',
|
||||
template='<ietf-secretariat-reply@ietf.org>')
|
||||
|
||||
rc(slug='doc_authors',
|
||||
desc="The document's authors",
|
||||
template='{% if doc.type_id == "draft" %}{{doc.name}}@ietf.org{% endif %}')
|
||||
template='{% if doc.type_id == "draft" %}<{{doc.name}}@ietf.org>{% endif %}')
|
||||
|
||||
rc(slug='doc_notify',
|
||||
desc="The addresses in the document's notify field",
|
||||
|
@ -55,11 +59,11 @@ def make_recipients(apps):
|
|||
|
||||
rc(slug='doc_shepherd',
|
||||
desc="The document's shepherd",
|
||||
template='{% if doc.shepherd %}{{doc.shepherd.address}}{% endif %}' )
|
||||
template='{% if doc.shepherd %}<{{doc.shepherd.address}}>{% endif %}' )
|
||||
|
||||
rc(slug='doc_ad',
|
||||
desc="The document's responsible Area Director",
|
||||
template='{% if doc.ad %}{{doc.ad.email_address}}{% endif %}' )
|
||||
template='{% if doc.ad %}<{{doc.ad.email_address}}>{% endif %}' )
|
||||
|
||||
rc(slug='doc_group_mail_list',
|
||||
desc="The list address of the document's group",
|
||||
|
@ -99,7 +103,7 @@ def make_recipients(apps):
|
|||
|
||||
rc(slug='group_mail_list',
|
||||
desc="The group's mailing list",
|
||||
template='{{ group.list_email }}')
|
||||
template='<{{ group.list_email }}>')
|
||||
|
||||
rc(slug='group_steering_group',
|
||||
desc="The group's steering group (IESG or IRSG)",
|
||||
|
@ -119,7 +123,7 @@ def make_recipients(apps):
|
|||
|
||||
rc(slug='internet_draft_requests',
|
||||
desc="The internet drafts ticketing system",
|
||||
template='internet-drafts@ietf.org')
|
||||
template='<internet-drafts@ietf.org>')
|
||||
|
||||
rc(slug='submission_submitter',
|
||||
desc="The person that submitted a draft",
|
||||
|
@ -159,15 +163,15 @@ def make_recipients(apps):
|
|||
|
||||
rc(slug='session_requests',
|
||||
desc="The session request ticketing system",
|
||||
template='session-request@ietf.org')
|
||||
template='<session-request@ietf.org>')
|
||||
|
||||
rc(slug='logged_in_person',
|
||||
desc="The person currently logged into the datatracker who initiated a given action",
|
||||
template='{% if person and person.email_address %}{{ person.email_address }}{% endif %}')
|
||||
template='{% if person and person.email_address %}<{{ person.email_address }}>{% endif %}')
|
||||
|
||||
rc(slug='ipr_requests',
|
||||
desc="The ipr disclosure handling system",
|
||||
template='ietf-ipr@ietf.org')
|
||||
template='<ietf-ipr@ietf.org>')
|
||||
|
||||
rc(slug='ipr_submitter',
|
||||
desc="The submitter of an IPR disclosure",
|
||||
|
@ -209,12 +213,28 @@ def make_recipients(apps):
|
|||
|
||||
rc(slug='liaison_statements_list',
|
||||
desc="The IETF liaison statement ticketing system",
|
||||
template='statements@ietf.org')
|
||||
template='<statements@ietf.org>')
|
||||
|
||||
rc(slug='liaison_manager',
|
||||
desc="The assigned liaison manager for an external group ",
|
||||
template=None)
|
||||
|
||||
rc(slug='nominator',
|
||||
desc="The person that submitted a nomination to nomcom",
|
||||
template='{{nominator}}')
|
||||
|
||||
rc(slug='nominee',
|
||||
desc="The person nominated for a position",
|
||||
template='{{nominee}}')
|
||||
|
||||
rc(slug='nomcom_chair',
|
||||
desc="The chair of a given nomcom",
|
||||
template='{{nomcom.group.get_chair.email.address}}')
|
||||
|
||||
rc(slug='commenter',
|
||||
desc="The person providing a comment to nomcom",
|
||||
template='{{commenter}}')
|
||||
|
||||
def make_mailtokens(apps):
|
||||
|
||||
Recipient=apps.get_model('mailtoken','Recipient')
|
||||
|
@ -743,6 +763,48 @@ def make_mailtokens(apps):
|
|||
recipient_slugs=['liaison_manager',
|
||||
])
|
||||
|
||||
mt_factory(slug='nomination_received',
|
||||
desc="Recipients for a message noting a new nomination has been received",
|
||||
recipient_slugs=['nomcom_chair',
|
||||
])
|
||||
|
||||
mt_factory(slug='nomination_receipt_requested',
|
||||
desc="Recipients for a message confirming a nomination was made",
|
||||
recipient_slugs=['nominator',
|
||||
])
|
||||
|
||||
mt_factory(slug='nomcom_comment_receipt_requested',
|
||||
desc="Recipients for a message confirming a comment was made",
|
||||
recipient_slugs=['commenter',
|
||||
])
|
||||
|
||||
mt_factory(slug='nomination_created_person',
|
||||
desc="Recipients for a message noting that a nomination caused a "
|
||||
"new Person record to be created in the datatracker",
|
||||
recipient_slugs=['ietf_secretariat',
|
||||
'nomcom_chair',
|
||||
])
|
||||
mt_factory(slug='nomination_new_nominee',
|
||||
desc="Recipients the first time a person is nominated for a position, "
|
||||
"asking them to accept or decline the nomination",
|
||||
recipient_slugs=['nominee',
|
||||
])
|
||||
|
||||
mt_factory(slug='nomination_accept_reminder',
|
||||
desc="Recipeints of message reminding a nominee to accept or decline a nomination",
|
||||
recipient_slugs=['nominee',
|
||||
])
|
||||
|
||||
mt_factory(slug='nomcom_questionnaire',
|
||||
desc="Recipients for the questionairre that nominees should complete",
|
||||
recipient_slugs=['nominee',
|
||||
])
|
||||
|
||||
mt_factory(slug='nomcom_questionnaire_reminder',
|
||||
desc="Recipients for a message reminding a nominee to return a completed questionairre response",
|
||||
recipient_slugs=['nominee',
|
||||
])
|
||||
|
||||
def forward(apps, schema_editor):
|
||||
|
||||
make_recipients(apps)
|
||||
|
|
|
@ -4327,6 +4327,14 @@
|
|||
"model": "doc.ballottype",
|
||||
"pk": 3
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{{commenter}}",
|
||||
"desc": "The person providing a comment to nomcom"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "commenter"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": null,
|
||||
|
@ -4345,7 +4353,7 @@
|
|||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{% if doc.ad %}{{doc.ad.email_address}}{% endif %}",
|
||||
"template": "{% if doc.ad %}<{{doc.ad.email_address}}>{% endif %}",
|
||||
"desc": "The document's responsible Area Director"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
|
@ -4377,7 +4385,7 @@
|
|||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{% if doc.type_id == \"draft\" %}{{doc.name}}@ietf.org{% endif %}",
|
||||
"template": "{% if doc.type_id == \"draft\" %}<{{doc.name}}@ietf.org>{% endif %}",
|
||||
"desc": "The document's authors"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
|
@ -4449,7 +4457,7 @@
|
|||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{% if doc.shepherd %}{{doc.shepherd.address}}{% endif %}",
|
||||
"template": "{% if doc.shepherd %}<{{doc.shepherd.address}}>{% endif %}",
|
||||
"desc": "The document's shepherd"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
|
@ -4481,7 +4489,7 @@
|
|||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{{ group.list_email }}",
|
||||
"template": "<{{ group.list_email }}>",
|
||||
"desc": "The group's mailing list"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
|
@ -4561,7 +4569,15 @@
|
|||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "internet-drafts@ietf.org",
|
||||
"template": "<ietf-secretariat-reply@ietf.org>",
|
||||
"desc": "The Secretariat"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "ietf_secretariat"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "<internet-drafts@ietf.org>",
|
||||
"desc": "The internet drafts ticketing system"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
|
@ -4577,7 +4593,7 @@
|
|||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "ietf-ipr@ietf.org",
|
||||
"template": "<ietf-ipr@ietf.org>",
|
||||
"desc": "The ipr disclosure handling system"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
|
@ -4633,7 +4649,7 @@
|
|||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "statements@ietf.org",
|
||||
"template": "<statements@ietf.org>",
|
||||
"desc": "The IETF liaison statement ticketing system"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
|
@ -4657,12 +4673,36 @@
|
|||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{% if person and person.email_address %}{{ person.email_address }}{% endif %}",
|
||||
"template": "{% if person and person.email_address %}<{{ person.email_address }}>{% endif %}",
|
||||
"desc": "The person currently logged into the datatracker who initiated a given action"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "logged_in_person"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{{nomcom.group.get_chair.email.address}}",
|
||||
"desc": "The chair of a given nomcom"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "nomcom_chair"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{{nominator}}",
|
||||
"desc": "The person that submitted a nomination to nomcom"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "nominator"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{{nominee}}",
|
||||
"desc": "The person nominated for a position"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "nominee"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "<rfc-editor@rfc-editor.org>",
|
||||
|
@ -4681,7 +4721,7 @@
|
|||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "session-request@ietf.org",
|
||||
"template": "<session-request@ietf.org>",
|
||||
"desc": "The session request ticketing system"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
|
@ -5415,6 +5455,87 @@
|
|||
"model": "mailtoken.mailtoken",
|
||||
"pk": "milestone_review_reminder_cc"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"commenter"
|
||||
],
|
||||
"desc": "Recipients for a message confirming a comment was made"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "nomcom_comment_receipt_requested"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"nominee"
|
||||
],
|
||||
"desc": "Recipients for the questionairre that nominees should complete"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "nomcom_questionnaire"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"nominee"
|
||||
],
|
||||
"desc": "Recipients for a message reminding a nominee to return a completed questionairre response"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "nomcom_questionnaire_reminder"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"nominee"
|
||||
],
|
||||
"desc": "Recipeints of message reminding a nominee to accept or decline a nomination"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "nomination_accept_reminder"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"ietf_secretariat",
|
||||
"nomcom_chair"
|
||||
],
|
||||
"desc": "Recipients for a message noting that a nomination caused a new Person record to be created in the datatracker"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "nomination_created_person"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"nominee"
|
||||
],
|
||||
"desc": "Recipients the first time a person is nominated for a position, asking them to accept or decline the nomination"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "nomination_new_nominee"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"nominator"
|
||||
],
|
||||
"desc": "Recipients for a message confirming a nomination was made"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "nomination_receipt_requested"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"nomcom_chair"
|
||||
],
|
||||
"desc": "Recipients for a message noting a new nomination has been received"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "nomination_received"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
|
|
|
@ -20,6 +20,7 @@ from ietf.person.models import Email
|
|||
from ietf.person.fields import SearchableEmailField
|
||||
from ietf.utils.fields import MultiEmailField
|
||||
from ietf.utils.mail import send_mail
|
||||
from ietf.mailtoken.utils import gather_address_list
|
||||
|
||||
|
||||
ROLODEX_URL = getattr(settings, 'ROLODEX_URL', None)
|
||||
|
@ -407,7 +408,7 @@ class NominateForm(BaseNomcomForm, forms.ModelForm):
|
|||
if author:
|
||||
subject = 'Nomination receipt'
|
||||
from_email = settings.NOMCOM_FROM_EMAIL
|
||||
to_email = author.address
|
||||
to_email = gather_address_list('nomination_receipt_requested',nominator=author.address)
|
||||
context = {'nominee': nominee.email.person.name,
|
||||
'comments': comments,
|
||||
'position': position.name}
|
||||
|
@ -525,7 +526,7 @@ class FeedbackForm(BaseNomcomForm, forms.ModelForm):
|
|||
if author:
|
||||
subject = "NomCom comment confirmation"
|
||||
from_email = settings.NOMCOM_FROM_EMAIL
|
||||
to_email = author.address
|
||||
to_email = gather_address_list('nomcom_comment_receipt_requested',commenter=author.address)
|
||||
context = {'nominee': self.nominee.email.person.name,
|
||||
'comments': comments,
|
||||
'position': self.position.name}
|
||||
|
|
|
@ -18,6 +18,7 @@ from django.utils.encoding import smart_str
|
|||
|
||||
from ietf.dbtemplate.models import DBTemplate
|
||||
from ietf.person.models import Email, Person
|
||||
from ietf.mailtoken.utils import gather_address_list
|
||||
from ietf.utils.pipe import pipe
|
||||
from ietf.utils import unaccent
|
||||
from ietf.utils.mail import send_mail_text, send_mail
|
||||
|
@ -207,7 +208,7 @@ def send_accept_reminder_to_nominee(nominee_position):
|
|||
nomcom_template_path = '/nomcom/%s/' % nomcom.group.acronym
|
||||
mail_path = nomcom_template_path + NOMINEE_ACCEPT_REMINDER_TEMPLATE
|
||||
nominee = nominee_position.nominee
|
||||
to_email = nominee.email.address
|
||||
to_email = gather_address_list('nomination_accept_reminder',nominee=nominee.email.address)
|
||||
|
||||
hash = get_hash_nominee_position(today, nominee_position.id)
|
||||
accept_url = reverse('nomcom_process_nomination_status',
|
||||
|
@ -244,7 +245,7 @@ def send_questionnaire_reminder_to_nominee(nominee_position):
|
|||
nomcom_template_path = '/nomcom/%s/' % nomcom.group.acronym
|
||||
mail_path = nomcom_template_path + NOMINEE_QUESTIONNAIRE_REMINDER_TEMPLATE
|
||||
nominee = nominee_position.nominee
|
||||
to_email = nominee.email.address
|
||||
to_email = gather_address_list('nomcom_questionnaire_reminder',nominee=nominee.email.address)
|
||||
|
||||
context = {'nominee': nominee,
|
||||
'position': position,
|
||||
|
@ -274,8 +275,6 @@ def get_or_create_nominee(nomcom, candidate_name, candidate_email, position, aut
|
|||
from ietf.nomcom.models import Nominee, NomineePosition
|
||||
|
||||
nomcom_template_path = '/nomcom/%s/' % nomcom.group.acronym
|
||||
nomcom_chair = nomcom.group.get_chair()
|
||||
nomcom_chair_mail = nomcom_chair and nomcom_chair.email.address or None
|
||||
|
||||
# Create person and email if candidate email does't exist and send email
|
||||
email, created_email = Email.objects.get_or_create(address=candidate_email)
|
||||
|
@ -296,20 +295,18 @@ def get_or_create_nominee(nomcom, candidate_name, candidate_email, position, aut
|
|||
# send email to secretariat and nomcomchair to warn about the new person
|
||||
subject = 'New person is created'
|
||||
from_email = settings.NOMCOM_FROM_EMAIL
|
||||
to_email = [settings.NOMCOM_ADMIN_EMAIL]
|
||||
to_email = gather_address_list('nomination_created_person',nomcom=nomcom)
|
||||
context = {'email': email.address,
|
||||
'fullname': email.person.name,
|
||||
'person_id': email.person.id}
|
||||
path = nomcom_template_path + INEXISTENT_PERSON_TEMPLATE
|
||||
if nomcom_chair_mail:
|
||||
to_email.append(nomcom_chair_mail)
|
||||
send_mail(None, to_email, from_email, subject, path, context)
|
||||
|
||||
if nominee_position_created:
|
||||
# send email to nominee
|
||||
subject = 'IETF Nomination Information'
|
||||
from_email = settings.NOMCOM_FROM_EMAIL
|
||||
to_email = email.address
|
||||
to_email = gather_address_list('nomination_new_nominee',nominee=email.address)
|
||||
domain = Site.objects.get_current().domain
|
||||
today = datetime.date.today().strftime('%Y%m%d')
|
||||
hash = get_hash_nominee_position(today, nominee_position.id)
|
||||
|
@ -341,7 +338,7 @@ def get_or_create_nominee(nomcom, candidate_name, candidate_email, position, aut
|
|||
if nomcom.send_questionnaire:
|
||||
subject = '%s Questionnaire' % position
|
||||
from_email = settings.NOMCOM_FROM_EMAIL
|
||||
to_email = email.address
|
||||
to_email = gather_address_list('nomcom_questionnaire',nominee=email.address)
|
||||
context = {'nominee': email.person.name,
|
||||
'position': position.name}
|
||||
path = '%s%d/%s' % (nomcom_template_path,
|
||||
|
@ -355,7 +352,7 @@ def get_or_create_nominee(nomcom, candidate_name, candidate_email, position, aut
|
|||
# send emails to nomcom chair
|
||||
subject = 'Nomination Information'
|
||||
from_email = settings.NOMCOM_FROM_EMAIL
|
||||
to_email = nomcom_chair_mail
|
||||
to_email = gather_address_list('nomination_received',nomcom=nomcom)
|
||||
context = {'nominee': email.person.name,
|
||||
'nominee_email': email.address,
|
||||
'position': position.name}
|
||||
|
|
|
@ -413,7 +413,6 @@ LIAISON_ATTACH_URL = '/documents/LIAISON/'
|
|||
ROLODEX_URL = ""
|
||||
NOMCOM_PUBLIC_KEYS_DIR = '/a/www/nomcom/public_keys/'
|
||||
NOMCOM_FROM_EMAIL = 'nomcom-chair@ietf.org'
|
||||
NOMCOM_ADMIN_EMAIL = DEFAULT_FROM_EMAIL
|
||||
OPENSSL_COMMAND = '/usr/bin/openssl'
|
||||
DAYS_TO_EXPIRE_NOMINATION_LINK = ''
|
||||
DEFAULT_FEEDBACK_TYPE = 'offtopic'
|
||||
|
|
Loading…
Reference in a new issue