preparing to merge forward to 6.31
- Legacy-Id: 11875
This commit is contained in:
parent
b6978debb6
commit
2009afe7b8
|
@ -190,7 +190,8 @@ class Recipient(models.Model):
|
|||
|
||||
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 of that existing document, and the chairs if the document is
|
||||
a working group document and the author list has changed. Otherwise, the confirmers
|
||||
are the authors and submitter of the submitted document."""
|
||||
|
||||
addrs=[]
|
||||
|
@ -198,7 +199,11 @@ class Recipient(models.Model):
|
|||
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()])
|
||||
old_authors = [i.author.formatted_email() for i in doc.documentauthor_set.all() if not i.author.invalid_address()]
|
||||
new_authors = [u'"%s" <%s>' % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]]
|
||||
addrs.extend(old_authors)
|
||||
if doc.group and set(old_authors)!=set(new_authors):
|
||||
addrs.extend(Recipient.objects.get(slug='group_chairs').gather(**{'group':doc.group}))
|
||||
else:
|
||||
addrs.extend([u"%s <%s>" % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]])
|
||||
if submission.submitter_parsed()["email"]:
|
||||
|
|
|
@ -10,7 +10,7 @@ from ietf.message.models import Message
|
|||
from ietf.utils.accesstoken import generate_access_token
|
||||
from ietf.mailtrigger.utils import gather_address_lists
|
||||
|
||||
def send_submission_confirmation(request, submission):
|
||||
def send_submission_confirmation(request, submission, chair_notice=False):
|
||||
subject = 'Confirm submission of I-D %s' % submission.name
|
||||
from_email = settings.IDSUBMIT_FROM_EMAIL
|
||||
(to_email, cc) = gather_address_lists('sub_confirmation_requested',submission=submission)
|
||||
|
@ -23,6 +23,7 @@ def send_submission_confirmation(request, submission):
|
|||
'submission': submission,
|
||||
'confirm_url': confirm_url,
|
||||
'status_url': status_url,
|
||||
'chair_notice': chair_notice,
|
||||
},
|
||||
cc=cc)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ from ietf.utils.mail import outbox
|
|||
from ietf.utils.test_utils import TestCase
|
||||
from ietf.meeting.models import Meeting
|
||||
from ietf.submit.utils import expirable_submissions, expire_submission, ensure_person_email_info_exists
|
||||
from ietf.person.models import Person
|
||||
from ietf.person.models import Person, Email
|
||||
from ietf.group.models import Group
|
||||
from ietf.doc.models import Document, DocAlias, DocEvent, State, BallotDocEvent, BallotPositionDocEvent, DocumentAuthor
|
||||
from ietf.submit.models import Submission, Preapproval
|
||||
|
@ -263,14 +263,19 @@ class SubmitTests(TestCase):
|
|||
def text_submit_new_wg_txt_xml(self):
|
||||
self.submit_new_wg(["txt", "xml"])
|
||||
|
||||
def submit_existing(self, formats):
|
||||
def submit_existing(self, formats, change_authors=True):
|
||||
# submit new revision of existing -> supply submitter info -> prev authors confirm
|
||||
draft = make_test_data()
|
||||
prev_author = draft.documentauthor_set.all()[0]
|
||||
if not change_authors:
|
||||
draft.documentauthor_set.all().delete()
|
||||
ensure_person_email_info_exists('Author Name','author@example.com')
|
||||
draft.documentauthor_set.create(author=Email.objects.get(address='author@example.com'))
|
||||
else:
|
||||
# Make it such that one of the previous authors has an invalid email address
|
||||
bogus_email = ensure_person_email_info_exists('Bogus Person',None)
|
||||
DocumentAuthor.objects.create(document=draft,author=bogus_email,order=draft.documentauthor_set.latest('order').order+1)
|
||||
|
||||
# Make it such that one of the previous authors has an invalid email address
|
||||
bogus_email = ensure_person_email_info_exists('Bogus Person',None)
|
||||
DocumentAuthor.objects.create(document=draft,author=bogus_email,order=draft.documentauthor_set.latest('order').order+1)
|
||||
prev_author = draft.documentauthor_set.all()[0]
|
||||
|
||||
# pretend IANA reviewed it
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iana-review", slug="not-ok"))
|
||||
|
@ -316,11 +321,18 @@ class SubmitTests(TestCase):
|
|||
self.assertTrue("Confirm submission" in confirm_email["Subject"])
|
||||
self.assertTrue(name in confirm_email["Subject"])
|
||||
self.assertTrue(prev_author.author.address in confirm_email["To"])
|
||||
# submitter and new author can't confirm
|
||||
self.assertTrue("author@example.com" not in confirm_email["To"])
|
||||
if change_authors:
|
||||
self.assertTrue("author@example.com" not in confirm_email["To"])
|
||||
self.assertTrue("submitter@example.com" not in confirm_email["To"])
|
||||
# Verify that mail wasn't sent to know invalid addresses
|
||||
self.assertTrue("unknown-email-" not in confirm_email["To"])
|
||||
if change_authors:
|
||||
# Since authors changed, ensure chairs are copied (and that the message says why)
|
||||
self.assertTrue("chairs have been copied" in unicode(confirm_email))
|
||||
self.assertTrue("mars-chairs@" in confirm_email["To"].lower())
|
||||
else:
|
||||
self.assertTrue("chairs have been copied" not in unicode(confirm_email))
|
||||
self.assertTrue("mars-chairs@" not in confirm_email["To"].lower())
|
||||
|
||||
confirm_url = self.extract_confirm_url(confirm_email)
|
||||
|
||||
|
@ -373,6 +385,9 @@ class SubmitTests(TestCase):
|
|||
def test_submit_existing_txt_xml(self):
|
||||
self.submit_existing(["txt", "xml"])
|
||||
|
||||
def test_submit_existing_txt_preserve_authors(self):
|
||||
self.submit_existing(["txt"],change_authors=False)
|
||||
|
||||
def submit_new_individual(self, formats):
|
||||
# submit new -> supply submitter info -> confirm
|
||||
draft = make_test_data()
|
||||
|
@ -430,6 +445,8 @@ class SubmitTests(TestCase):
|
|||
|
||||
def test_submit_update_individual(self):
|
||||
draft = make_test_data()
|
||||
draft.group = None
|
||||
draft.save()
|
||||
replaces_count = draft.relateddocument_set.filter(relationship_id='replaces').count()
|
||||
name = draft.name
|
||||
rev = '%02d'%(int(draft.rev)+1)
|
||||
|
|
|
@ -208,6 +208,13 @@ def submission_status(request, submission_id, access_token=None):
|
|||
|
||||
requires_prev_authors_approval = Document.objects.filter(name=submission.name)
|
||||
|
||||
group_authors_changed = False
|
||||
doc = submission.existing_document()
|
||||
if doc and doc.group:
|
||||
old_authors = [i.author.formatted_email() for i in doc.documentauthor_set.all() if not i.author.invalid_address()]
|
||||
new_authors = [u'"%s" <%s>' % (author["name"], author["email"]) for author in submission.authors_parsed() if author["email"]]
|
||||
group_authors_changed = set(old_authors)!=set(new_authors)
|
||||
|
||||
message = None
|
||||
|
||||
if submission.state_id == "cancel":
|
||||
|
@ -253,7 +260,7 @@ def submission_status(request, submission_id, access_token=None):
|
|||
submission.state = DraftSubmissionStateName.objects.get(slug="auth")
|
||||
submission.save()
|
||||
|
||||
sent_to = send_submission_confirmation(request, submission)
|
||||
sent_to = send_submission_confirmation(request, submission, chair_notice=group_authors_changed)
|
||||
|
||||
if submission.state_id == "aut-appr":
|
||||
desc = u"sent confirmation email to previous authors: %s" % u", ".join(sent_to)
|
||||
|
|
|
@ -4,8 +4,10 @@ Hi,
|
|||
The IETF datatracker draft submission service has received your draft
|
||||
{{ submission.name }}-{{ submission.rev }}, and requires a
|
||||
confirmation step in order to be able to complete the posting of
|
||||
the draft.
|
||||
the draft.{% if chair_notice %}
|
||||
|
||||
The chairs have been copied since this is a group document whose author list has changed.
|
||||
{%endif%}
|
||||
Please follow this link to the page where you can confirm the posting:
|
||||
|
||||
{{ confirm_url }}
|
||||
|
|
Loading…
Reference in a new issue