diff --git a/lms/djangoapps/bulk_email/data.py b/lms/djangoapps/bulk_email/data.py index 6bc8cdb27422..99f97281f595 100644 --- a/lms/djangoapps/bulk_email/data.py +++ b/lms/djangoapps/bulk_email/data.py @@ -20,9 +20,9 @@ class BulkEmailTargetChoices: SEND_TO_LEARNERS = "learners" SEND_TO_COHORT = "cohort" SEND_TO_TRACK = "track" - SEND_TO_INDIVIDUAL_STUDENTS = "individual-students" + SEND_TO_INDIVIDUAL_LEARNERS = "individual-learners" - TARGET_CHOICES = (SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK, SEND_TO_INDIVIDUAL_STUDENTS) + TARGET_CHOICES = (SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK, SEND_TO_INDIVIDUAL_LEARNERS) @classmethod def is_valid_target(cls, target): diff --git a/lms/djangoapps/bulk_email/migrations/0009_alter_target_target_type.py b/lms/djangoapps/bulk_email/migrations/0009_alter_target_target_type.py new file mode 100644 index 000000000000..8036eff320fc --- /dev/null +++ b/lms/djangoapps/bulk_email/migrations/0009_alter_target_target_type.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.20 on 2023-09-12 19:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('bulk_email', '0008_alter_target_target_type'), + ] + + operations = [ + migrations.AlterField( + model_name='target', + name='target_type', + field=models.CharField(choices=[('myself', 'Myself'), ('staff', 'Staff and instructors'), ('learners', 'All students'), ('cohort', 'Specific cohort'), ('track', 'Specific course mode'), ('individual-learners', 'Specific list of students')], max_length=64), + ), + ] diff --git a/lms/djangoapps/bulk_email/models.py b/lms/djangoapps/bulk_email/models.py index 9e31d70c1a04..330abc04c3bb 100644 --- a/lms/djangoapps/bulk_email/models.py +++ b/lms/djangoapps/bulk_email/models.py @@ -55,9 +55,9 @@ class Meta: SEND_TO_LEARNERS = 'learners' SEND_TO_COHORT = 'cohort' SEND_TO_TRACK = 'track' -SEND_TO_INDIVIDUAL_STUDENTS = 'individual-students' +SEND_TO_INDIVIDUAL_LEARNERS = 'individual-learners' EMAIL_TARGET_CHOICES = list(zip( - [SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK, SEND_TO_INDIVIDUAL_STUDENTS], + [SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK, SEND_TO_INDIVIDUAL_LEARNERS], ['Myself', 'Staff and instructors', 'All students', 'Specific cohort', 'Specific course mode', 'Specific list of students'] )) EMAIL_TARGETS = {target[0] for target in EMAIL_TARGET_CHOICES} @@ -149,7 +149,7 @@ def get_users(self, course_id, user_id=None, emails=None): & enrollment_query ) ) - elif self.target_type == SEND_TO_INDIVIDUAL_STUDENTS: + elif self.target_type == SEND_TO_INDIVIDUAL_LEARNERS: return use_read_replica_if_available( User.objects.filter( models.Q(email__in=emails) diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index 7f0727b6904b..914723bb6db2 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -2704,7 +2704,7 @@ def send_email(request, course_id): return HttpResponseForbidden("Email is not enabled for this course.") targets = json.loads(request.POST.get("send_to")) - emails = json.loads(request.POST.get("emails", [])) + emails = json.loads(request.POST.get("individual_learners_emails", [])) subject = request.POST.get("subject") message = request.POST.get("message") # optional, this is a date and time in the form of an ISO8601 string