diff --git a/edx_proctoring/api.py b/edx_proctoring/api.py index 748ff5dce76..135e0874e04 100644 --- a/edx_proctoring/api.py +++ b/edx_proctoring/api.py @@ -1662,7 +1662,6 @@ def update_attempt_status(attempt_id, to_status, } ) email = create_proctoring_attempt_status_email( - user_id, exam_attempt_obj, course_name, exam['course_id'] @@ -1730,7 +1729,7 @@ def update_attempt_status(attempt_id, to_status, return attempt['id'] -def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_name, course_id): +def create_proctoring_attempt_status_email(exam_attempt_obj, course_name, course_id): """ Creates an email about change in proctoring attempt status. """ @@ -1738,7 +1737,6 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam if not exam_attempt_obj.taking_as_proctored or exam_attempt_obj.is_sample_attempt: return None - user = USER_MODEL.objects.get(id=user_id) email_subject = ( _('Proctoring Results For {course_name} {exam_name}').format( course_name=course_name, @@ -1748,16 +1746,13 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam status = exam_attempt_obj.status if status == ProctoredExamStudentAttemptStatus.submitted: template_name = 'proctoring_attempt_submitted_email.html' - email_subject = ( - _('Proctoring Review In Progress For {course_name} {exam_name}').format( - course_name=course_name, - exam_name=exam_attempt_obj.proctored_exam.exam_name - ) - ) + email_subject = 'Proctoring attempt submitted' elif status == ProctoredExamStudentAttemptStatus.verified: template_name = 'proctoring_attempt_satisfactory_email.html' + email_subject = 'Proctoring attempt verified' elif status == ProctoredExamStudentAttemptStatus.rejected: template_name = 'proctoring_attempt_unsatisfactory_email.html' + email_subject = 'Proctoring attempt rejected' else: # Don't send an email for any other attempt status codes return None @@ -1767,11 +1762,6 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam course_home_url = get_course_home_url(exam_attempt_obj.proctored_exam.course_id) exam_name = exam_attempt_obj.proctored_exam.exam_name - support_email_subject = _('Proctored exam {exam_name} in {course_name} for user {username}').format( - exam_name=exam_name, - course_name=course_name, - username=user.username, - ) scheme = 'https' if getattr(settings, 'HTTPS', 'on') == 'on' else 'http' default_contact_url = f'{scheme}://{constants.SITE_NAME}/support/contact_us' @@ -1788,13 +1778,11 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam contact_url_text = contact_url body = email_template.render({ - 'username': user.username, 'course_url': course_home_url, 'course_name': course_name, 'exam_name': exam_name, 'status': status, 'platform': constants.PLATFORM_NAME, - 'support_email_subject': support_email_subject, 'contact_url': contact_url, 'contact_url_text': contact_url_text, }) diff --git a/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html b/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html index f98832eec83..56b64c86d61 100644 --- a/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html +++ b/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html @@ -3,7 +3,7 @@
{% block introduction %} {% blocktrans %} - Hello {{ username }}, + Hello, {% endblocktrans %} {% endblock %}
diff --git a/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html b/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html index 2107cef5e42..9997990d6a2 100644 --- a/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html +++ b/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html @@ -3,7 +3,7 @@{% block introduction %} {% blocktrans %} - Hello {{ username }}, + Hello, {% endblocktrans %} {% endblock %}
diff --git a/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html b/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html index 14d6db42ccd..c932357799a 100644 --- a/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html +++ b/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html @@ -3,7 +3,7 @@{% block introduction %} {% blocktrans %} - Hello {{ username }}, + Hello, {% endblocktrans %} {% endblock %}
diff --git a/edx_proctoring/tests/test_email.py b/edx_proctoring/tests/test_email.py index e9a5313b854..4df3595c5e0 100644 --- a/edx_proctoring/tests/test_email.py +++ b/edx_proctoring/tests/test_email.py @@ -54,17 +54,17 @@ def tearDown(self): @ddt.data( [ ProctoredExamStudentAttemptStatus.submitted, - 'Proctoring Review In Progress', + 'Proctoring attempt submitted', 'was submitted successfully', ], [ ProctoredExamStudentAttemptStatus.verified, - 'Proctoring Results', + 'Proctoring attempt verified', 'was reviewed and you met all proctoring requirements', ], [ ProctoredExamStudentAttemptStatus.rejected, - 'Proctoring Results', + 'Proctoring attempt rejected', 'the course team has identified one or more violations', ] ) @@ -84,11 +84,10 @@ def test_send_email(self, status, expected_subject, expected_message_string): # Verify the subject actual_subject = self._normalize_whitespace(mail.outbox[0].subject) self.assertIn(expected_subject, actual_subject) - self.assertIn(self.exam_name, actual_subject) # Verify the body actual_body = self._normalize_whitespace(mail.outbox[0].body) - self.assertIn('Hello tester,', actual_body) + self.assertIn('Hello,', actual_body) self.assertIn('Your proctored exam "Test Exam"', actual_body) self.assertIn(credit_state['course_name'], actual_body) self.assertIn(expected_message_string, actual_body) @@ -223,8 +222,7 @@ def test_send_email_unicode(self): # Verify the subject actual_subject = self._normalize_whitespace(mail.outbox[0].subject) - self.assertIn('Proctoring Review In Progress', actual_subject) - self.assertIn(course_name, actual_subject) + self.assertIn('Proctoring attempt submitted', actual_subject) # Verify the body actual_body = self._normalize_whitespace(mail.outbox[0].body)