Skip to content

Commit 23a2ada

Browse files
committed
checkpoint
- Legacy-Id: 10027
1 parent 56ddf4c commit 23a2ada

9 files changed

Lines changed: 262 additions & 33 deletions

File tree

ietf/ipr/mail.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
import os
66
import pytz
77
import re
8-
from django.conf import settings
98
from django.template.loader import render_to_string
109

1110
from ietf.ipr.models import IprEvent
1211
from ietf.message.models import Message
1312
from ietf.person.models import Person
1413
from ietf.utils.log import log
14+
from ietf.mailtoken.utils import get_base_ipr_request_address
1515

1616
# ----------------------------------------------------------------
1717
# Date Functions
@@ -89,7 +89,7 @@ def get_pseudo_submitter(ipr):
8989
def get_reply_to():
9090
"""Returns a new reply-to address for use with an outgoing message. This is an
9191
address with "plus addressing" using a random string. Guaranteed to be unique"""
92-
local,domain = settings.IPR_EMAIL_TO.split('@')
92+
local,domain = get_base_ipr_request_address().split('@')
9393
while True:
9494
rand = base64.urlsafe_b64encode(os.urandom(12))
9595
address = "{}+{}@{}".format(local,rand,domain)
@@ -167,7 +167,7 @@ def process_response_email(msg):
167167
to = message.get('To')
168168

169169
# exit if this isn't a response we're interested in (with plus addressing)
170-
local,domain = settings.IPR_EMAIL_TO.split('@')
170+
local,domain = get_base_ipr_request_address().split('@')
171171
if not re.match(r'^{}\+[a-zA-Z0-9_\-]{}@{}'.format(local,'{16}',domain),to):
172172
return None
173173

@@ -193,4 +193,4 @@ def process_response_email(msg):
193193
)
194194

195195
log(u"Received IPR email from %s" % ietf_message.frm)
196-
return ietf_message
196+
return ietf_message

ietf/ipr/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from pyquery import PyQuery
55

6-
from django.conf import settings
76
from django.core.urlresolvers import reverse as urlreverse
87

98
from ietf.doc.models import DocAlias
@@ -16,6 +15,7 @@
1615
from ietf.utils.test_utils import TestCase, login_testing_unauthorized
1716
from ietf.utils.test_data import make_test_data
1817
from ietf.utils.mail import outbox
18+
from ietf.mailtoken.utils import gather_addresses
1919

2020

2121
class IprTests(TestCase):
@@ -519,7 +519,7 @@ def test_process_response_email(self):
519519
From: joe@test.com
520520
Date: {}
521521
Subject: test
522-
""".format(settings.IPR_EMAIL_TO,datetime.datetime.now().ctime())
522+
""".format(gather_addresses('ipr_disclosure_submitted'),datetime.datetime.now().ctime())
523523
result = process_response_email(message_string)
524524
self.assertIsNone(result)
525525

ietf/ipr/views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from ietf.secr.utils.document import get_rfc_num, is_draft
3636
from ietf.utils.draft_search import normalize_draftname
3737
from ietf.utils.mail import send_mail, send_mail_message
38+
from ietf.mailtoken.utils import gather_address_list
3839

3940
# ----------------------------------------------------------------
4041
# Globals
@@ -379,7 +380,7 @@ def email(request, id):
379380
reply_to = get_reply_to()
380381
initial = {
381382
'to': ipr.submitter_email,
382-
'frm': settings.IPR_EMAIL_TO,
383+
'frm': settings.IPR_EMAIL_FROM,
383384
'subject': 'Regarding {}'.format(ipr.title),
384385
'reply_to': reply_to,
385386
}
@@ -474,7 +475,8 @@ def new(request, type, updates=None):
474475
desc="Disclosure Submitted")
475476

476477
# send email notification
477-
send_mail(request, settings.IPR_EMAIL_TO, ('IPR Submitter App', 'ietf-ipr@ietf.org'),
478+
to = gather_address_list('ipr_disclosure_submitted')
479+
send_mail(request, to, ('IPR Submitter App', 'ietf-ipr@ietf.org'),
478480
'New IPR Submission Notification',
479481
"ipr/new_update_email.txt",
480482
{"ipr": disclosure,})

ietf/mailtoken/migrations/0002_auto_20150809_1314.py

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def make_recipients(apps):
117117
desc="The document's group's responsible AD(s) or IRTF chair",
118118
template=None)
119119

120-
rc(slug='internet_drafts',
120+
rc(slug='internet_draft_requests',
121121
desc="The internet drafts ticketing system",
122122
template='internet-drafts@ietf.org')
123123

@@ -157,6 +157,18 @@ def make_recipients(apps):
157157
desc="Any personnel who were added or deleted when a group's personnel changes",
158158
template='{{ changed_personnel | join:", " }}')
159159

160+
rc(slug='session_requests',
161+
desc="The session request ticketing system",
162+
template='session-request@ietf.org')
163+
164+
rc(slug='ipr_requests',
165+
desc="The ipr disclosure handling system",
166+
template='ietf-ipr@ietf.org')
167+
168+
rc(slug='logged_in_person',
169+
desc="The person currently logged into the datatracker who initiated a given action",
170+
template='{% if person and person.email_address %}{{ person.email_address }}{% endif %}')
171+
160172
def make_mailtokens(apps):
161173

162174
Recipient=apps.get_model('mailtoken','Recipient')
@@ -467,7 +479,7 @@ def mt_factory(slug,desc,recipient_slugs):
467479

468480
mt_factory(slug='resurrection_requested',
469481
desc="Recipients of a request to change the state of a draft away from 'Dead'",
470-
recipient_slugs=['internet_drafts',])
482+
recipient_slugs=['internet_draft_requests',])
471483

472484
mt_factory(slug='resurrection_completed',
473485
desc="Recipients when a draft resurrection request has been completed",
@@ -477,7 +489,7 @@ def mt_factory(slug,desc,recipient_slugs):
477489

478490
mt_factory(slug='sub_manual_post_requested',
479491
desc="Recipients for a manual post request for a draft submission",
480-
recipient_slugs=['internet_drafts',
492+
recipient_slugs=['internet_draft_requests',
481493
])
482494

483495
mt_factory(slug='sub_manual_post_requested_cc',
@@ -552,6 +564,74 @@ def mt_factory(slug,desc,recipient_slugs):
552564
'group_changed_personnel',
553565
])
554566

567+
mt_factory(slug='session_requested',
568+
desc="Recipients for a normal meeting session request",
569+
recipient_slugs=['session_requests',
570+
])
571+
572+
mt_factory(slug='session_requested_cc',
573+
desc="Copied on a normal meeting session request",
574+
recipient_slugs=['group_mail_list',
575+
'group_chairs',
576+
'group_responsible_directors',
577+
'logged_in_person',
578+
])
579+
580+
mt_factory(slug='session_requested_long',
581+
desc="Recipients for a meeting session request for more than 2 sessions",
582+
recipient_slugs=['group_responsible_directors',
583+
])
584+
585+
mt_factory(slug='session_requested_long_cc',
586+
desc="Copied on a meeting session request for more than 2 sessions",
587+
recipient_slugs=['session_requests',
588+
'group_chairs',
589+
'logged_in_person',
590+
])
591+
592+
mt_factory(slug='session_request_cancelled',
593+
desc="Recipients for a message cancelling a session request",
594+
recipient_slugs=['session_requests',
595+
])
596+
597+
mt_factory(slug='session_request_cancelled_cc',
598+
desc="Copied on a message cancelling a session request",
599+
recipient_slugs=['group_mail_list',
600+
'group_chairs',
601+
'group_responsible_directors',
602+
'logged_in_person',
603+
])
604+
605+
mt_factory(slug='session_request_not_meeting',
606+
desc="Recipients for a message noting a group plans to not meet",
607+
recipient_slugs=['session_requests',
608+
])
609+
610+
mt_factory(slug='session_request_not_meeting_cc',
611+
desc="Copied on a message noting a group plans to not meet",
612+
recipient_slugs=['group_mail_list',
613+
'group_chairs',
614+
'group_responsible_directors',
615+
'logged_in_person',
616+
])
617+
618+
mt_factory(slug='session_scheduled',
619+
desc="Recipients for details when a session has been scheduled",
620+
recipient_slugs=['session_requester',
621+
'group_chairs',
622+
])
623+
624+
mt_factory(slug='session_scheduled_cc',
625+
desc="Recipients for details when a session has been scheduled",
626+
recipient_slugs=['group_mail_list',
627+
'group_responsible_directors',
628+
])
629+
630+
mt_factory(slug='ipr_disclosure_submitted',
631+
desc="Recipients when an IPR notification is submitted",
632+
recipient_slugs=['ipr_requests',
633+
])
634+
555635
def forward(apps, schema_editor):
556636

557637
make_recipients(apps)

ietf/mailtoken/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
from django.core.exceptions import ObjectDoesNotExist
32

4-
from ietf.mailtoken.models import MailToken
3+
from ietf.mailtoken.models import MailToken, Recipient
54

65
def gather_address_list(slug,**kwargs):
76

@@ -21,3 +20,8 @@ def gather_address_list(slug,**kwargs):
2120

2221
def gather_addresses(slug,**kwargs):
2322
return ",\n ".join(gather_address_list(slug,**kwargs))
23+
24+
def get_base_ipr_request_address():
25+
return Recipient.objects.get(slug='ipr_requests').gather()[0]
26+
27+

0 commit comments

Comments
 (0)