checkpoint
- Legacy-Id: 10019
This commit is contained in:
parent
c39ebe4f56
commit
89f038a1e3
|
@ -7,9 +7,10 @@ from pathlib import Path
|
|||
|
||||
from ietf.utils.mail import send_mail
|
||||
from ietf.doc.models import Document, DocEvent, State, save_document_in_history, IESG_SUBSTATE_TAGS
|
||||
from ietf.person.models import Person, Email
|
||||
from ietf.person.models import Person
|
||||
from ietf.meeting.models import Meeting
|
||||
from ietf.doc.utils import add_state_change_event
|
||||
from ietf.mailtoken.utils import gather_address_list
|
||||
|
||||
|
||||
|
||||
|
@ -70,10 +71,8 @@ def send_expire_warning_for_draft(doc):
|
|||
|
||||
expiration = doc.expires.date()
|
||||
|
||||
to = [e.formatted_email() for e in doc.authors.all() if not e.address.startswith("unknown-email")]
|
||||
cc = None
|
||||
if doc.group.type_id in ("wg", "rg"):
|
||||
cc = [e.formatted_email() for e in Email.objects.filter(role__group=doc.group, role__name="chair") if not e.address.startswith("unknown-email")]
|
||||
to = gather_address_list('doc_expires_soon',doc=doc)
|
||||
cc = gather_address_list('doc_expires_soon_cc',doc=doc)
|
||||
|
||||
s = doc.get_state("draft-iesg")
|
||||
state = s.name if s else "I-D Exists"
|
||||
|
@ -91,21 +90,23 @@ def send_expire_warning_for_draft(doc):
|
|||
cc=cc)
|
||||
|
||||
def send_expire_notice_for_draft(doc):
|
||||
if not doc.ad or doc.get_state_slug("draft-iesg") == "dead":
|
||||
if doc.get_state_slug("draft-iesg") == "dead":
|
||||
return
|
||||
|
||||
s = doc.get_state("draft-iesg")
|
||||
state = s.name if s else "I-D Exists"
|
||||
|
||||
request = None
|
||||
to = doc.ad.role_email("ad").formatted_email()
|
||||
to = gather_address_list('doc_expired',doc=doc)
|
||||
cc = gather_address_list('doc_expired_cc',doc=doc)
|
||||
send_mail(request, to,
|
||||
"I-D Expiring System <ietf-secretariat-reply@ietf.org>",
|
||||
u"I-D was expired %s" % doc.file_tag(),
|
||||
"doc/draft/id_expired_email.txt",
|
||||
dict(doc=doc,
|
||||
state=state,
|
||||
))
|
||||
),
|
||||
cc=cc)
|
||||
|
||||
def move_draft_files_to_archive(doc, rev):
|
||||
def move_file(f):
|
||||
|
|
|
@ -261,7 +261,7 @@ def send_last_call_request(request, doc):
|
|||
cc=cc)
|
||||
|
||||
def email_resurrect_requested(request, doc, by):
|
||||
to = "I-D Administrator <internet-drafts@ietf.org>"
|
||||
to = gather_address_list('resurrection_requested',doc=doc)
|
||||
|
||||
if by.role_set.filter(name="secr", group__acronym="secretariat"):
|
||||
e = by.role_email("secr", group="secretariat")
|
||||
|
@ -277,12 +277,7 @@ def email_resurrect_requested(request, doc, by):
|
|||
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url()))
|
||||
|
||||
def email_resurrection_completed(request, doc, requester):
|
||||
if requester.role_set.filter(name="secr", group__acronym="secretariat"):
|
||||
e = requester.role_email("secr", group="secretariat")
|
||||
else:
|
||||
e = requester.role_email("ad")
|
||||
|
||||
to = e.formatted_email()
|
||||
to = gather_address_list('resurrection_completed',doc=doc)
|
||||
frm = "I-D Administrator <internet-drafts-reply@ietf.org>"
|
||||
send_mail(request, to, frm,
|
||||
"I-D Resurrection Completed - %s" % doc.file_tag(),
|
||||
|
|
|
@ -524,7 +524,7 @@ class ExpireIDsTests(TestCase):
|
|||
|
||||
self.assertEqual(len(outbox), mailbox_before + 1)
|
||||
self.assertTrue("aread@ietf.org" in str(outbox[-1])) # author
|
||||
self.assertTrue("marschairman@ietf.org" in str(outbox[-1]))
|
||||
self.assertTrue("mars-chairs@ietf.org" in str(outbox[-1]))
|
||||
|
||||
def test_expire_drafts(self):
|
||||
from ietf.doc.expire import get_expired_drafts, send_expire_notice_for_draft, expire_draft
|
||||
|
|
|
@ -15,7 +15,7 @@ from ietf.group.utils import milestone_reviewer_for_group_type
|
|||
from ietf.mailtoken.utils import gather_address_list
|
||||
|
||||
def email_iesg_secretary_re_charter(request, group, subject, text):
|
||||
to = ["iesg-secretary@ietf.org"]
|
||||
to = gather_address_list('charter_state_message_provided',group=group)
|
||||
full_subject = u"Regarding %s %s: %s" % (group.type.name, group.acronym, subject)
|
||||
text = strip_tags(text)
|
||||
|
||||
|
|
|
@ -117,6 +117,42 @@ def make_recipients(apps):
|
|||
desc="The document's group's responsible AD(s) or IRTF chair",
|
||||
template=None)
|
||||
|
||||
rc(slug='internet_drafts',
|
||||
desc="The internet drafts ticketing system",
|
||||
template='internet-drafts@ietf.org')
|
||||
|
||||
rc(slug='submission_submitter',
|
||||
desc="The person that submitted a draft",
|
||||
template='{{submission.submitter}}')
|
||||
|
||||
rc(slug='submission_authors',
|
||||
desc="The authors of a submitted draft",
|
||||
template=None)
|
||||
|
||||
rc(slug='submission_group_chairs',
|
||||
desc="The chairs of a submitted draft belonging to a group",
|
||||
template=None)
|
||||
|
||||
rc(slug='submission_confirmers',
|
||||
desc="The people who can confirm a draft submission",
|
||||
template=None)
|
||||
|
||||
rc(slug='submission_group_mail_list',
|
||||
desc="The people who can confirm a draft submission",
|
||||
template=None)
|
||||
|
||||
rc(slug='doc_non_ietf_stream_manager',
|
||||
desc="The document's stream manager if the document is not in the IETF stream",
|
||||
template=None)
|
||||
|
||||
rc(slug='rfc_editor_if_doc_in_queue',
|
||||
desc="The RFC Editor if a document is in the RFC Editor queue",
|
||||
template=None)
|
||||
|
||||
rc(slug='doc_discussing_ads',
|
||||
desc="Any ADs holding an active DISCUSS position on a given document",
|
||||
template=None)
|
||||
|
||||
def make_mailtokens(apps):
|
||||
|
||||
Recipient=apps.get_model('mailtoken','Recipient')
|
||||
|
@ -393,6 +429,94 @@ def make_mailtokens(apps):
|
|||
'doc_group_responsible_directors',
|
||||
])
|
||||
|
||||
mt_factory(slug='charter_state_message_provided',
|
||||
desc="Recipients for extra message when provided on the charter state editing form",
|
||||
recipient_slugs=['iesg_secretary'])
|
||||
|
||||
mt_factory(slug='doc_expires_soon',
|
||||
desc="Recipients for notification of impending expiration of a document",
|
||||
recipient_slugs=['doc_authors'])
|
||||
|
||||
mt_factory(slug='doc_expires_soon_cc',
|
||||
desc="Copied on notification of impending expiration of a document",
|
||||
recipient_slugs=['doc_notify',
|
||||
'doc_shepherd',
|
||||
'doc_group_chairs',
|
||||
'doc_group_responsible_directors',
|
||||
])
|
||||
|
||||
mt_factory(slug='doc_expired',
|
||||
desc="Recipients for notification of a document's expiration",
|
||||
recipient_slugs=['doc_authors'])
|
||||
|
||||
mt_factory(slug='doc_expired_cc',
|
||||
desc="Copied on notification of a document's expiration",
|
||||
recipient_slugs=['doc_notify',
|
||||
'doc_shepherd',
|
||||
'doc_group_chairs',
|
||||
'doc_group_responsible_directors',
|
||||
])
|
||||
|
||||
mt_factory(slug='resurrection_requested',
|
||||
desc="Recipients of a request to change the state of a draft away from 'Dead'",
|
||||
recipient_slugs=['internet_drafts',])
|
||||
|
||||
mt_factory(slug='resurrection_completed',
|
||||
desc="Recipients when a draft resurrection request has been completed",
|
||||
recipient_slugs=['iesg_secretary',
|
||||
'doc_ad',
|
||||
])
|
||||
|
||||
mt_factory(slug='sub_manual_post_requested',
|
||||
desc="Recipients for a manual post request for a draft submission",
|
||||
recipient_slugs=['internet_drafts',
|
||||
])
|
||||
|
||||
mt_factory(slug='sub_manual_post_requested_cc',
|
||||
desc="Copied on a manual post request for a draft submission",
|
||||
recipient_slugs=['submission_submitter',
|
||||
'submission_authors',
|
||||
'submission_group_chairs',
|
||||
])
|
||||
|
||||
mt_factory(slug='sub_chair_approval_requested',
|
||||
desc="Recipients for a message requesting group chair approval of a draft submission",
|
||||
recipient_slugs=['submission_group_chairs',])
|
||||
|
||||
mt_factory(slug='sub_confirmation_requested',
|
||||
desc="Recipients for a message requesting confirmation of a draft submission",
|
||||
recipient_slugs=['submission_confirmers',])
|
||||
|
||||
mt_factory(slug='sub_management_url_requested',
|
||||
desc="Recipients for a message with the full URL for managing a draft submission",
|
||||
recipient_slugs=['submission_confirmers',])
|
||||
|
||||
mt_factory(slug='sub_announced',
|
||||
desc="Recipients for the announcement of a successfully submitted draft",
|
||||
recipient_slugs=['ietf_announce',
|
||||
])
|
||||
|
||||
mt_factory(slug='sub_announced_cc',
|
||||
desc="Copied on the announcement of a successfully submitted draft",
|
||||
recipient_slugs=['submission_group_mail_list',
|
||||
])
|
||||
|
||||
mt_factory(slug='sub_announced_to_authors',
|
||||
desc="Recipients for the announcement to the authors of a successfully submitted draft",
|
||||
recipient_slugs=['submission_authors',
|
||||
'submission_confirmers',
|
||||
])
|
||||
|
||||
mt_factory(slug='sub_new_version',
|
||||
desc="Recipient for notification of a new version of an existing document",
|
||||
recipient_slugs=['doc_notify',
|
||||
'doc_ad',
|
||||
'non_ietf_stream_manager',
|
||||
'rfc_editor_if_doc_in_queue',
|
||||
'doc_discussing_ads',
|
||||
])
|
||||
|
||||
|
||||
def forward(apps, schema_editor):
|
||||
|
||||
make_recipients(apps)
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
from django.db import models
|
||||
from django.template import Template, Context
|
||||
|
||||
from ietf.group.models import Role
|
||||
|
||||
class MailToken(models.Model):
|
||||
slug = models.CharField(max_length=32, primary_key=True)
|
||||
desc = models.TextField(blank=True)
|
||||
|
@ -52,7 +50,7 @@ class Recipient(models.Model):
|
|||
if 'doc' in kwargs:
|
||||
doc=kwargs['doc']
|
||||
if doc.group and doc.group.type.slug in ['wg','rg']:
|
||||
addrs.extend(Role.objects.filter(group=doc.group,name='delegate').values_list('email__address',flat=True))
|
||||
addrs.extend(doc.group.role_set.filter(name='delegate').values_list('email__address',flat=True))
|
||||
return addrs
|
||||
|
||||
def gather_doc_group_mail_list(self, **kwargs):
|
||||
|
@ -125,11 +123,19 @@ class Recipient(models.Model):
|
|||
addrs.extend(Recipient.objects.get(slug='stream_managers').gather(**{'streams':[kwargs['doc'].stream_id]}))
|
||||
return addrs
|
||||
|
||||
def gather_doc_non_ietf_stream_manager(self, **kwargs):
|
||||
addrs = []
|
||||
if 'doc' in kwargs:
|
||||
doc = kwargs['doc']
|
||||
if doc.stream_id and doc.stream_id != 'ietf':
|
||||
addrs.extend(Recipient.objects.get(slug='stream_managers').gather(**{'streams':[doc.stream_id,]}))
|
||||
return addrs
|
||||
|
||||
def gather_group_responsible_directors(self, **kwargs):
|
||||
addrs = []
|
||||
if 'group' in kwargs:
|
||||
group = kwargs['group']
|
||||
addrs.extend(Role.objects.filter(group=group,name='ad').values_list('email__address',flat=True))
|
||||
addrs.extend(group.role_set.filter(name='ad').values_list('email__address',flat=True))
|
||||
if group.type_id=='rg':
|
||||
addrs.extend(Recipient.objects.get(slug='stream_managers').gather(**{'streams':['irtf']}))
|
||||
return addrs
|
||||
|
@ -141,3 +147,62 @@ class Recipient(models.Model):
|
|||
if group:
|
||||
addrs.extend(Recipient.objects.get(slug='group_responsible_directors').gather(**{'group':group}))
|
||||
return addrs
|
||||
|
||||
def gather_submission_authors(self, **kwargs):
|
||||
addrs = []
|
||||
if 'submission' in kwargs:
|
||||
submission = kwargs['submission']
|
||||
addrs.extend(["%s <%s>" % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]])
|
||||
return addrs
|
||||
|
||||
def gather_submission_group_chairs(self, **kwargs):
|
||||
addrs = []
|
||||
if 'submission' in kwargs:
|
||||
submission = kwargs['submission']
|
||||
if submission.group:
|
||||
addrs.extend(Recipient.objects.get(slug='group_chairs').gather(**{'group':submission.group}))
|
||||
return addrs
|
||||
|
||||
def gather_submission_confirmers(self, **kwargs):
|
||||
"""If a submitted document is revising an existing document, the confirmers
|
||||
are the authors of that existing document. Otherwise, the confirmers
|
||||
are the authors and submitter of the submitted document."""
|
||||
|
||||
addrs=[]
|
||||
if 'submission' in kwargs:
|
||||
submission = kwargs['submission']
|
||||
doc=submission.existing_document()
|
||||
if doc:
|
||||
addrs.extend([i.author.formatted_email() for i in doc.documentauthor_set.all() if not i.author.invalid_address()])
|
||||
else:
|
||||
addrs.extend([u"%s <%s>" % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]])
|
||||
if submission.submitter_parsed()["email"]:
|
||||
addrs.append(submission.submitter)
|
||||
return addrs
|
||||
|
||||
def gather_submission_group_mail_list(self, **kwargs):
|
||||
addrs=[]
|
||||
if 'submission' in kwargs:
|
||||
submission = kwargs['submission']
|
||||
if submission.group:
|
||||
addrs.extend(Recipient.objects.get(slug='group_mail_list').gather(**{'group':submission.group}))
|
||||
return addrs
|
||||
|
||||
def gather_rfc_editor_if_doc_in_queue(self, **kwargs):
|
||||
addrs=[]
|
||||
if 'doc' in kwargs:
|
||||
doc = kwargs['doc']
|
||||
if doc.get_state_slug("draft-rfceditor") is not None:
|
||||
addrs.extend(Recipient.objects.get(slug='rfc_editor').gather(**{}))
|
||||
return addrs
|
||||
|
||||
def gather_doc_discussing_ads(self, **kwargs):
|
||||
addrs=[]
|
||||
if 'doc' in kwargs:
|
||||
doc = kwargs['doc']
|
||||
active_ballot = doc.active_ballot()
|
||||
if active_ballot:
|
||||
for ad, pos in active_ballot.active_ad_positions().iteritems():
|
||||
if pos and pos.pos_id == "discuss":
|
||||
addrs.append(ad.role_email("ad").address)
|
||||
return addrs
|
||||
|
|
|
@ -4383,6 +4383,14 @@
|
|||
"model": "mailtoken.recipient",
|
||||
"pk": "doc_authors"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": null,
|
||||
"desc": "Any ADs holding an active DISCUSS position on a given document"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "doc_discussing_ads"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": null,
|
||||
|
@ -4415,6 +4423,14 @@
|
|||
"model": "mailtoken.recipient",
|
||||
"pk": "doc_group_responsible_directors"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": null,
|
||||
"desc": "The document's stream manager if the document is not in the IETF stream"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "doc_non_ietf_stream_manager"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{{doc.notify}}",
|
||||
|
@ -4527,6 +4543,14 @@
|
|||
"model": "mailtoken.recipient",
|
||||
"pk": "ietf_announce"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "internet-drafts@ietf.org",
|
||||
"desc": "The internet drafts ticketing system"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "internet_drafts"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "<rfc-editor@rfc-editor.org>",
|
||||
|
@ -4535,6 +4559,14 @@
|
|||
"model": "mailtoken.recipient",
|
||||
"pk": "rfc_editor"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": null,
|
||||
"desc": "The RFC Editor if a document is in the RFC Editor queue"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "rfc_editor_if_doc_in_queue"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": null,
|
||||
|
@ -4543,6 +4575,46 @@
|
|||
"model": "mailtoken.recipient",
|
||||
"pk": "stream_managers"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": null,
|
||||
"desc": "The authors of a submitted draft"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "submission_authors"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": null,
|
||||
"desc": "The people who can confirm a draft submission"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "submission_confirmers"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": null,
|
||||
"desc": "The chairs of a submitted draft belonging to a group"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "submission_group_chairs"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": null,
|
||||
"desc": "The people who can confirm a draft submission"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "submission_group_mail_list"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"template": "{{submission.submitter}}",
|
||||
"desc": "The person that submitted a draft"
|
||||
},
|
||||
"model": "mailtoken.recipient",
|
||||
"pk": "submission_submitter"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
|
@ -4719,6 +4791,16 @@
|
|||
"model": "mailtoken.mailtoken",
|
||||
"pk": "charter_external_review_cc"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"iesg_secretary"
|
||||
],
|
||||
"desc": "Recipients for extra message when provided on the charter state editing form"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "charter_state_message_provided"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
|
@ -4753,6 +4835,52 @@
|
|||
"model": "mailtoken.mailtoken",
|
||||
"pk": "conflrev_requested_iana"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"doc_authors"
|
||||
],
|
||||
"desc": "Recipients for notification of a document's expiration"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "doc_expired"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"doc_group_chairs",
|
||||
"doc_group_responsible_directors",
|
||||
"doc_notify",
|
||||
"doc_shepherd"
|
||||
],
|
||||
"desc": "Copied on notification of a document's expiration"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "doc_expired_cc"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"doc_authors"
|
||||
],
|
||||
"desc": "Recipients for notification of impending expiration of a document"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "doc_expires_soon"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"doc_group_chairs",
|
||||
"doc_group_responsible_directors",
|
||||
"doc_notify",
|
||||
"doc_shepherd"
|
||||
],
|
||||
"desc": "Copied on notification of impending expiration of a document"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "doc_expires_soon_cc"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
|
@ -5012,5 +5140,122 @@
|
|||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "pubreq_rfced_iana"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"doc_ad",
|
||||
"iesg_secretary"
|
||||
],
|
||||
"desc": "Recipients when a draft resurrection request has been completed"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "resurrection_completed"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"internet_drafts"
|
||||
],
|
||||
"desc": "Recipients of a request to change the state of a draft away from 'Dead'"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "resurrection_requested"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"ietf_announce"
|
||||
],
|
||||
"desc": "Recipients for the announcement of a successfully submitted draft"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "sub_announced"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"submission_group_mail_list"
|
||||
],
|
||||
"desc": "Copied on the announcement of a successfully submitted draft"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "sub_announced_cc"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"submission_authors",
|
||||
"submission_confirmers"
|
||||
],
|
||||
"desc": "Recipients for the announcement to the authors of a successfully submitted draft"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "sub_announced_to_authors"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"submission_group_chairs"
|
||||
],
|
||||
"desc": "Recipients for a message requesting group chair approval of a draft submission"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "sub_chair_approval_requested"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"submission_confirmers"
|
||||
],
|
||||
"desc": "Recipients for a message requesting confirmation of a draft submission"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "sub_confirmation_requested"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"submission_confirmers"
|
||||
],
|
||||
"desc": "Recipients for a message with the full URL for managing a draft submission"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "sub_management_url_requested"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"internet_drafts"
|
||||
],
|
||||
"desc": "Recipients for a manual post request for a draft submission"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "sub_manual_post_requested"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"submission_authors",
|
||||
"submission_group_chairs",
|
||||
"submission_submitter"
|
||||
],
|
||||
"desc": "Copied on a manual post request for a draft submission"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "sub_manual_post_requested_cc"
|
||||
},
|
||||
{
|
||||
"fields": {
|
||||
"recipients": [
|
||||
"doc_ad",
|
||||
"doc_discussing_ads",
|
||||
"doc_notify",
|
||||
"rfc_editor_if_doc_in_queue"
|
||||
],
|
||||
"desc": "Recipient for notification of a new version of an existing document"
|
||||
},
|
||||
"model": "mailtoken.mailtoken",
|
||||
"pk": "sub_new_version"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -421,7 +421,6 @@ NOMINEE_FEEDBACK_TYPES = ['comment', 'questio', 'nomina']
|
|||
|
||||
# ID Submission Tool settings
|
||||
IDSUBMIT_FROM_EMAIL = 'IETF I-D Submission Tool <idsubmission@ietf.org>'
|
||||
IDSUBMIT_TO_EMAIL = 'internet-drafts@ietf.org'
|
||||
IDSUBMIT_ANNOUNCE_FROM_EMAIL = 'internet-drafts@ietf.org'
|
||||
IDSUBMIT_ANNOUNCE_LIST_EMAIL = 'i-d-announce@ietf.org'
|
||||
|
||||
|
|
|
@ -6,25 +6,14 @@ from django.template.loader import render_to_string
|
|||
from ietf.utils.mail import send_mail, send_mail_message
|
||||
from ietf.doc.models import Document
|
||||
from ietf.person.models import Person
|
||||
from ietf.group.models import Role
|
||||
from ietf.message.models import Message
|
||||
from ietf.utils.accesstoken import generate_access_token
|
||||
|
||||
def submission_confirmation_email_list(submission):
|
||||
try:
|
||||
doc = Document.objects.get(name=submission.name)
|
||||
email_list = [i.author.formatted_email() for i in doc.documentauthor_set.all() if not i.author.invalid_address()]
|
||||
except Document.DoesNotExist:
|
||||
email_list = [u"%s <%s>" % (author["name"], author["email"])
|
||||
for author in submission.authors_parsed() if author["email"]]
|
||||
if submission.submitter_parsed()["email"] and submission.submitter not in email_list:
|
||||
email_list.append(submission.submitter)
|
||||
return email_list
|
||||
from ietf.mailtoken.utils import gather_address_list
|
||||
|
||||
def send_submission_confirmation(request, submission):
|
||||
subject = 'Confirm submission of I-D %s' % submission.name
|
||||
from_email = settings.IDSUBMIT_FROM_EMAIL
|
||||
to_email = submission_confirmation_email_list(submission)
|
||||
to_email = gather_address_list('sub_confirmation_requested',submission=submission)
|
||||
|
||||
confirm_url = settings.IDTRACKER_BASE_URL + urlreverse('submit_confirm_submission', kwargs=dict(submission_id=submission.pk, auth_token=generate_access_token(submission.auth_key)))
|
||||
status_url = settings.IDTRACKER_BASE_URL + urlreverse('submit_submission_status_by_hash', kwargs=dict(submission_id=submission.pk, access_token=submission.access_token()))
|
||||
|
@ -40,7 +29,7 @@ def send_submission_confirmation(request, submission):
|
|||
def send_full_url(request, submission):
|
||||
subject = 'Full URL for managing submission of draft %s' % submission.name
|
||||
from_email = settings.IDSUBMIT_FROM_EMAIL
|
||||
to_email = submission_confirmation_email_list(submission)
|
||||
to_email = gather_address_list('sub_management_url_requested',submission=submission)
|
||||
url = settings.IDTRACKER_BASE_URL + urlreverse('submit_submission_status_by_hash', kwargs=dict(submission_id=submission.pk, access_token=submission.access_token()))
|
||||
|
||||
send_mail(request, to_email, from_email, subject, 'submit/full_url.txt', {
|
||||
|
@ -53,7 +42,7 @@ def send_full_url(request, submission):
|
|||
def send_approval_request_to_group(request, submission):
|
||||
subject = 'New draft waiting for approval: %s' % submission.name
|
||||
from_email = settings.IDSUBMIT_FROM_EMAIL
|
||||
to_email = [r.formatted_email() for r in Role.objects.filter(group=submission.group, name="chair").select_related("email", "person")]
|
||||
to_email = gather_address_list('sub_chair_approval_requested',submission=submission)
|
||||
if not to_email:
|
||||
return to_email
|
||||
|
||||
|
@ -67,15 +56,8 @@ def send_approval_request_to_group(request, submission):
|
|||
def send_manual_post_request(request, submission, errors):
|
||||
subject = u'Manual Post Requested for %s' % submission.name
|
||||
from_email = settings.IDSUBMIT_FROM_EMAIL
|
||||
to_email = settings.IDSUBMIT_TO_EMAIL
|
||||
|
||||
cc = [submission.submitter]
|
||||
cc += [u"%s <%s>" % (author["name"], author["email"])
|
||||
for author in submission.authors_parsed() if author["email"]]
|
||||
if submission.group:
|
||||
cc += [r.formatted_email() for r in Role.objects.filter(group=submission.group, name="chair").select_related("email", "person")]
|
||||
cc = list(set(cc))
|
||||
|
||||
to_email = gather_address_list('sub_manual_post_requested',submission=submission)
|
||||
cc = gather_address_list('sub_manual_post_requested_cc',submission=submission)
|
||||
send_mail(request, to_email, from_email, subject, 'submit/manual_post_request.txt', {
|
||||
'submission': submission,
|
||||
'url': settings.IDTRACKER_BASE_URL + urlreverse('submit_submission_status', kwargs=dict(submission_id=submission.pk)),
|
||||
|
@ -93,9 +75,8 @@ def announce_to_lists(request, submission):
|
|||
pass
|
||||
m.subject = 'I-D Action: %s-%s.txt' % (submission.name, submission.rev)
|
||||
m.frm = settings.IDSUBMIT_ANNOUNCE_FROM_EMAIL
|
||||
m.to = settings.IDSUBMIT_ANNOUNCE_LIST_EMAIL
|
||||
if submission.group and submission.group.list_email:
|
||||
m.cc = submission.group.list_email
|
||||
m.to = gather_address_list('sub_announced',submission=submission)
|
||||
m.cc = gather_address_list('sub_announced_cc',submission=submission)
|
||||
m.body = render_to_string('submit/announce_to_lists.txt',
|
||||
dict(submission=submission,
|
||||
settings=settings))
|
||||
|
@ -106,28 +87,7 @@ def announce_to_lists(request, submission):
|
|||
|
||||
|
||||
def announce_new_version(request, submission, draft, state_change_msg):
|
||||
to_email = []
|
||||
if draft.notify:
|
||||
to_email.append(draft.notify)
|
||||
if draft.ad:
|
||||
to_email.append(draft.ad.role_email("ad").address)
|
||||
|
||||
if draft.stream_id == "iab":
|
||||
to_email.append("IAB Stream <iab-stream@iab.org>")
|
||||
elif draft.stream_id == "ise":
|
||||
to_email.append("Independent Submission Editor <rfc-ise@rfc-editor.org>")
|
||||
elif draft.stream_id == "irtf":
|
||||
to_email.append("IRSG <irsg@irtf.org>")
|
||||
|
||||
# if it has been sent to the RFC Editor, keep them in the loop
|
||||
if draft.get_state_slug("draft-rfceditor") is not None:
|
||||
to_email.append("RFC Editor <rfc-editor@rfc-editor.org>")
|
||||
|
||||
active_ballot = draft.active_ballot()
|
||||
if active_ballot:
|
||||
for ad, pos in active_ballot.active_ad_positions().iteritems():
|
||||
if pos and pos.pos_id == "discuss":
|
||||
to_email.append(ad.role_email("ad").address)
|
||||
to_email = gather_address_list('sub_new_version',doc=draft,submission=submission)
|
||||
|
||||
if to_email:
|
||||
subject = 'New Version Notification - %s-%s.txt' % (submission.name, submission.rev)
|
||||
|
@ -137,8 +97,7 @@ def announce_new_version(request, submission, draft, state_change_msg):
|
|||
'msg': state_change_msg})
|
||||
|
||||
def announce_to_authors(request, submission):
|
||||
authors = [u"%s <%s>" % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]]
|
||||
to_email = list(set(submission_confirmation_email_list(submission) + authors))
|
||||
to_email = gather_address_list('sub_announced_to_authors',submission=submission)
|
||||
from_email = settings.IDSUBMIT_ANNOUNCE_FROM_EMAIL
|
||||
subject = 'New Version Notification for %s-%s.txt' % (submission.name, submission.rev)
|
||||
if submission.group:
|
||||
|
|
|
@ -3,6 +3,7 @@ import datetime
|
|||
|
||||
from django.db import models
|
||||
|
||||
from ietf.doc.models import Document
|
||||
from ietf.person.models import Person
|
||||
from ietf.group.models import Group
|
||||
from ietf.name.models import DraftSubmissionStateName
|
||||
|
@ -62,6 +63,8 @@ class Submission(models.Model):
|
|||
def access_token(self):
|
||||
return generate_access_token(self.access_key)
|
||||
|
||||
def existing_document(self):
|
||||
return Document.objects.filter(name=self.name).first()
|
||||
|
||||
class SubmissionEvent(models.Model):
|
||||
submission = models.ForeignKey(Submission)
|
||||
|
|
|
@ -16,13 +16,14 @@ from ietf.doc.utils import prettify_std_name
|
|||
from ietf.group.models import Group
|
||||
from ietf.ietfauth.utils import has_role, role_required
|
||||
from ietf.submit.forms import SubmissionUploadForm, NameEmailForm, EditSubmissionForm, PreapprovalForm, ReplacesForm
|
||||
from ietf.submit.mail import send_full_url, send_approval_request_to_group, send_submission_confirmation, submission_confirmation_email_list, send_manual_post_request
|
||||
from ietf.submit.mail import send_full_url, send_approval_request_to_group, send_submission_confirmation, send_manual_post_request
|
||||
from ietf.submit.models import Submission, Preapproval, DraftSubmissionStateName
|
||||
from ietf.submit.utils import approvable_submissions_for_user, preapprovals_for_user, recently_approved_by_user
|
||||
from ietf.submit.utils import check_idnits, found_idnits, validate_submission, create_submission_event
|
||||
from ietf.submit.utils import post_submission, cancel_submission, rename_submission_files
|
||||
from ietf.utils.accesstoken import generate_random_key, generate_access_token
|
||||
from ietf.utils.draft import Draft
|
||||
from ietf.mailtoken.utils import gather_address_list
|
||||
|
||||
|
||||
def upload_submission(request):
|
||||
|
@ -180,7 +181,7 @@ def submission_status(request, submission_id, access_token=None):
|
|||
can_force_post = is_secretariat and submission.state.next_states.filter(slug="posted")
|
||||
show_send_full_url = not key_matched and not is_secretariat and submission.state_id not in ("cancel", "posted")
|
||||
|
||||
confirmation_list = submission_confirmation_email_list(submission)
|
||||
confirmation_list = gather_address_list('sub_confirmation_requested',submission=submission)
|
||||
|
||||
requires_group_approval = (submission.rev == '00' and submission.group and submission.group.type_id in ("wg", "rg", "ietf", "irtf", "iab", "iana", "rfcedtyp") and not Preapproval.objects.filter(name=submission.name).exists())
|
||||
|
||||
|
@ -205,7 +206,7 @@ def submission_status(request, submission_id, access_token=None):
|
|||
action = request.POST.get('action')
|
||||
if action == "autopost" and submission.state_id == "uploaded":
|
||||
if not can_edit:
|
||||
return HttpResponseForbidden("You do not have permission to perfom this action")
|
||||
return HttpResponseForbidden("You do not have permission to perform this action")
|
||||
|
||||
submitter_form = NameEmailForm(request.POST, prefix="submitter")
|
||||
replaces_form = ReplacesForm(request.POST, name=submission.name)
|
||||
|
|
Loading…
Reference in a new issue