From 3944d52cb4ad1b9bdef83412c38f77013b3e2b74 Mon Sep 17 00:00:00 2001 From: Simon Chen Date: Fri, 14 Feb 2020 10:20:16 -0500 Subject: [PATCH] Re-introduce the email template change now we have two proctoring providers. PROD-1073 Note the message update here is now working for both proctoring provider with their slightly different processes. --- edx_proctoring/__init__.py | 2 +- edx_proctoring/api.py | 9 ++--- ...proctoring_attempt_satisfactory_email.html | 9 +++-- .../proctoring_attempt_submitted_email.html | 13 ++----- ...octoring_attempt_unsatisfactory_email.html | 13 ++++--- edx_proctoring/tests/test_email.py | 35 ++++++------------- package.json | 2 +- 7 files changed, 30 insertions(+), 53 deletions(-) diff --git a/edx_proctoring/__init__.py b/edx_proctoring/__init__.py index bb13668893a..8d177914e01 100644 --- a/edx_proctoring/__init__.py +++ b/edx_proctoring/__init__.py @@ -5,6 +5,6 @@ from __future__ import absolute_import # Be sure to update the version number in edx_proctoring/package.json -__version__ = '2.2.6' +__version__ = '2.2.7' default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name diff --git a/edx_proctoring/api.py b/edx_proctoring/api.py index ad62a0ac197..b0f9e05700d 100644 --- a/edx_proctoring/api.py +++ b/edx_proctoring/api.py @@ -1145,9 +1145,10 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam course_name=course_name, username=user.username, ) - - exam = get_exam_by_id(exam_attempt_obj.proctored_exam.id) - contact_email = get_integration_specific_email(get_backend_provider(exam)) + contact_url = '{scheme}://{site_name}/support/contact_us'.format( + scheme=scheme, + site_name=constants.SITE_NAME + ) body = email_template.render({ 'username': user.username, @@ -1156,8 +1157,8 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam 'exam_name': exam_name, 'status': status, 'platform': constants.PLATFORM_NAME, - 'contact_email': contact_email, 'support_email_subject': support_email_subject, + 'contact_url': contact_url, }) email = EmailMessage( diff --git a/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html b/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html index 31acb0df680..562e60ddf1d 100644 --- a/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html +++ b/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html @@ -9,15 +9,14 @@ {% blocktrans %} Your proctored exam "{{ exam_name }}" in {{ course_name }} was reviewed and you - met all exam requirements. + met all proctoring requirements. {% endblocktrans %}

{% blocktrans %} - If you have any questions about your results, contact {{ platform }} - support at - - {{ contact_email }} + If you have any questions about your results, you can reach edX Support at + + {{ contact_url }} . {% endblocktrans %}

diff --git a/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html b/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html index b388a7982d7..bcc9e85a938 100644 --- a/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html +++ b/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html @@ -9,17 +9,8 @@ {% blocktrans %} Your proctored exam "{{ exam_name }}" in {{ course_name }} was submitted - successfully and will now be reviewed to ensure all proctoring exam - rules were followed. You should receive an email with your updated exam + successfully and will now be reviewed to ensure all exam + rules were followed. You should receive an email with your exam status within 5 business days. {% endblocktrans %}

-

- {% blocktrans %} - If you have any questions about proctoring, contact {{ platform }} - support at - - {{ contact_email }} - . - {% endblocktrans %} -

diff --git a/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html b/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html index ccd33318a04..0608e4635d6 100644 --- a/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html +++ b/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html @@ -9,20 +9,19 @@ {% blocktrans %} Your proctored exam "{{ exam_name }}" in {{ course_name }} was reviewed and the - team identified one or more violations of the proctored exam rules. Examples + course team has identified one or more violations of the proctored exam rules. Examples of issues that may result in a rules violation include browsing the internet, blurry or missing photo identification, using a phone, or getting help from another person. As a result of the identified issue(s), - you did not successfully meet the proctored - exam requirements. + you did not successfully meet the proctored exam requirements. {% endblocktrans %}

{% blocktrans %} - If you have any questions about your results, contact {{ platform }} - support at - - {{ contact_email }} + To appeal your proctored exam results, please reach out to edX Support with any relevant information + about your exam at + + {{ contact_url }} . {% endblocktrans %}

diff --git a/edx_proctoring/tests/test_email.py b/edx_proctoring/tests/test_email.py index 1c423b218a3..15b288fac15 100644 --- a/edx_proctoring/tests/test_email.py +++ b/edx_proctoring/tests/test_email.py @@ -10,8 +10,8 @@ from django.core import mail -from edx_proctoring.api import get_integration_specific_email, update_attempt_status -from edx_proctoring.backends import get_backend_provider +from edx_proctoring.api import update_attempt_status +from edx_proctoring.constants import SITE_NAME from edx_proctoring.runtime import get_runtime_service, set_runtime_service from edx_proctoring.statuses import ProctoredExamStudentAttemptStatus @@ -52,12 +52,12 @@ def tearDown(self): [ ProctoredExamStudentAttemptStatus.verified, 'Proctoring Results', - 'was reviewed and you met all exam requirements', + 'was reviewed and you met all proctoring requirements', ], [ ProctoredExamStudentAttemptStatus.rejected, 'Proctoring Results', - 'the team identified one or more violations', + 'the course team has identified one or more violations', ] ) @ddt.unpack @@ -176,34 +176,21 @@ def test_not_send_email_timed_exam(self, status): self.assertEqual(len(mail.outbox), 0) @ddt.data( - [ProctoredExamStudentAttemptStatus.submitted, 'edx@example.com'], - [ProctoredExamStudentAttemptStatus.submitted, ''], - [ProctoredExamStudentAttemptStatus.submitted, None], - [ProctoredExamStudentAttemptStatus.verified, 'edx@example.com'], - [ProctoredExamStudentAttemptStatus.verified, ''], - [ProctoredExamStudentAttemptStatus.verified, None], - [ProctoredExamStudentAttemptStatus.rejected, 'edx@example.com'], - [ProctoredExamStudentAttemptStatus.rejected, ''], - [ProctoredExamStudentAttemptStatus.rejected, None], + [ProctoredExamStudentAttemptStatus.verified], + [ProctoredExamStudentAttemptStatus.rejected], ) @ddt.unpack - def test_correct_edx_email(self, status, integration_specific_email,): + def test_correct_edx_support_url(self, status): exam_attempt = self._create_started_exam_attempt() - - test_backend = get_backend_provider(name='test') - - test_backend.integration_specific_email = integration_specific_email - update_attempt_status( exam_attempt.proctored_exam_id, self.user.id, status ) - # Verify the edX email - expected_email = get_integration_specific_email(test_backend) + # Verify the edX support URL + contact_url = 'http://{site_name}/support/contact_us'.format(site_name=SITE_NAME) actual_body = self._normalize_whitespace(mail.outbox[0].body) - self.assertIn(u'contact Open edX support at ' - u' ' - u'{email} '.format(email=expected_email), + self.assertIn(u' ' + u'{contact_url} '.format(contact_url=contact_url), actual_body) diff --git a/package.json b/package.json index 995e360116a..09146f5bb97 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@edx/edx-proctoring", "//": "Be sure to update the version number in edx_proctoring/__init__.py", "//": "Note that the version format is slightly different than that of the Python version when using prereleases.", - "version": "2.2.6", + "version": "2.2.7", "main": "edx_proctoring/static/index.js", "repository": { "type": "git",