Skip to content

Commit

Permalink
refactor: costume changes according MFE implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi committed Oct 9, 2023
1 parent eaaa23e commit 430f0fd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lms/djangoapps/bulk_email/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -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),
),
]
6 changes: 3 additions & 3 deletions lms/djangoapps/bulk_email/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/instructor/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 430f0fd

Please sign in to comment.