Merged in [12593] from rjsparks@nostrum.com:

Send mail to team secretaries when a review is explicitly requested. Change the From and Subject for assignment emails to reviewers to make it clearer what the review is for and who assigned it. Fixes #2053 and #2114.
 - Legacy-Id: 12602
Note: SVN reference [12593] has been migrated to Git commit 10f4892eae
This commit is contained in:
Henrik Levkowetz 2016-12-21 18:01:00 +00:00
commit ec0d6a7e4f
5 changed files with 31 additions and 6 deletions

View file

@ -49,7 +49,7 @@ class ReviewTests(TestCase):
review_team3 = Group.objects.get(acronym='reviewteam3')
url = urlreverse('ietf.doc.views_review.request_review', kwargs={ "name": doc.name })
login_testing_unauthorized(self, "reviewsecretary", url)
login_testing_unauthorized(self, "ad", url)
# get
r = self.client.get(url)
@ -57,13 +57,15 @@ class ReviewTests(TestCase):
deadline = datetime.date.today() + datetime.timedelta(days=10)
empty_outbox()
# post request
r = self.client.post(url, {
"type": "early",
"team": [review_team.pk,review_team3.pk],
"deadline": deadline.isoformat(),
"requested_rev": "01",
"requested_by": Person.objects.get(user__username="reviewsecretary").pk,
"requested_by": Person.objects.get(user__username="ad").pk,
"comment": "gZT2iiYqYLKiQHvsgWCcVLdH"
})
self.assertEqual(r.status_code, 302)
@ -77,6 +79,12 @@ class ReviewTests(TestCase):
self.assertEqual(doc.latest_event().type, "requested_review")
self.assertEqual(req.comment, "gZT2iiYqYLKiQHvsgWCcVLdH")
self.assertEqual(len(outbox),2)
self.assertTrue('reviewteam Early' in outbox[0]['Subject'])
self.assertTrue('reviewsecretary@' in outbox[0]['To'])
self.assertTrue('reviewteam3 Early' in outbox[1]['Subject'])
self.assertTrue('reviewsecretary3@' in outbox[1]['To'])
def test_request_review_of_rfc(self):
make_test_data()
doc = Document.objects.filter(states__type_id='draft',states__slug='rfc').first()

View file

@ -127,6 +127,15 @@ def request_review(request, name):
state=None,
)
subject = "%s %s Review requested" % (review_req.team.acronym, review_req.type.name)
msg = subject
if review_req.comment:
msg += "\n\n"+review_req.comment
email_review_request_change(request, review_req, subject, msg, by=request.user.person, notify_secretary=True, notify_reviewer=False, notify_requested_by=True)
return redirect('doc_view', name=doc.name)
else:

View file

@ -369,7 +369,7 @@ def email_review_request_change(request, review_req, subject, msg, by, notify_se
url = urlreverse("ietf.doc.views_review.review_request", kwargs={ "name": review_req.doc.name, "request_id": review_req.pk })
url = request.build_absolute_uri(url)
send_mail(request, to, None, subject, "review/review_request_changed.txt", {
send_mail(request, to, request.user.person.formatted_email(), subject, "review/review_request_changed.txt", {
"review_req_url": url,
"review_req": review_req,
"msg": msg,
@ -452,8 +452,8 @@ def assign_review_request_to_reviewer(request, review_req, reviewer):
email_review_request_change(
request, review_req,
"Assigned to review %s" % review_req.doc.name,
"%s has assigned you to review the document." % request.user.person,
"%s %s assignment: %s" % (review_req.team.acronym.capitalize(), review_req.type.name,review_req.doc.name),
"%s has assigned you as a reviewer for this document." % request.user.person,
by=request.user.person, notify_secretary=False, notify_reviewer=True, notify_requested_by=False)
def possibly_advance_next_reviewer_for_team(team, assigned_review_to_person_id):

View file

@ -1,6 +1,7 @@
{% autoescape off %}
{{ review_req.type.name }} review of: {{ review_req.doc.name }} ({% if review_req.requested_rev %}rev. {{ review_req.requested_rev }}{% else %}no specific version{% endif %})
Deadline: {{ review_req.deadline|date:"Y-m-d" }}
Deadline: {{ review_req.deadline|date:"Y-m-d" }}{% if review_req.requested_by %}
Requested by: {{ review_req.requested_by.plain_name }}{% endif %}
{{ review_req_url }}

View file

@ -424,6 +424,13 @@ def make_review_data(doc):
reviewsecretary = Person.objects.create(name=u"Réview Secretary", ascii="Review Secretary", user=u)
reviewsecretary_email = Email.objects.create(address="reviewsecretary@example.com", person=reviewsecretary)
Role.objects.create(name_id="secr", person=reviewsecretary, email=reviewsecretary_email, group=team1)
u = User.objects.create(username="reviewsecretary3")
u.set_password("reviewsecretary3+password")
u.save()
reviewsecretary3 = Person.objects.create(name=u"Réview Secretary3", ascii="Review Secretary3", user=u)
reviewsecretary3_email = Email.objects.create(address="reviewsecretary3@example.com", person=reviewsecretary)
Role.objects.create(name_id="secr", person=reviewsecretary3, email=reviewsecretary3_email, group=team3)
return review_req