Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
41fcd962
Commit
41fcd962
authored
11 years ago
by
Brian Wilson
Browse files
Options
Downloads
Patches
Plain Diff
Don't send emails to students who haven't activated.
parent
eaec962d
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/bulk_email/tasks.py
+3
-0
3 additions, 0 deletions
lms/djangoapps/bulk_email/tasks.py
lms/djangoapps/bulk_email/tests/test_tasks.py
+13
-0
13 additions, 0 deletions
lms/djangoapps/bulk_email/tests/test_tasks.py
with
16 additions
and
0 deletions
lms/djangoapps/bulk_email/tasks.py
+
3
−
0
View file @
41fcd962
...
...
@@ -93,7 +93,10 @@ def _get_recipient_queryset(user_id, to_option, course_id, course_location):
instructor_qset
=
instructor_group
.
user_set
.
all
()
recipient_qset
=
staff_qset
|
instructor_qset
if
to_option
==
SEND_TO_ALL
:
# We also require students to have activated their accounts to
# provide verification that the provided email address is valid.
enrollment_qset
=
User
.
objects
.
filter
(
is_active
=
True
,
courseenrollment__course_id
=
course_id
,
courseenrollment__is_active
=
True
)
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/bulk_email/tests/test_tasks.py
+
13
−
0
View file @
41fcd962
...
...
@@ -154,6 +154,19 @@ class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase):
get_conn
.
return_value
.
send_messages
.
side_effect
=
cycle
([
None
])
self
.
_test_run_with_task
(
send_bulk_course_email
,
'
emailed
'
,
num_emails
,
num_emails
)
def
test_unactivated_user
(
self
):
# Select number of emails to fit into a single subtask.
num_emails
=
settings
.
EMAILS_PER_TASK
# We also send email to the instructor:
students
=
self
.
_create_students
(
num_emails
-
1
)
# mark a student as not yet having activated their email:
student
=
students
[
0
]
student
.
is_active
=
False
student
.
save
()
with
patch
(
'
bulk_email.tasks.get_connection
'
,
autospec
=
True
)
as
get_conn
:
get_conn
.
return_value
.
send_messages
.
side_effect
=
cycle
([
None
])
self
.
_test_run_with_task
(
send_bulk_course_email
,
'
emailed
'
,
num_emails
-
1
,
num_emails
-
1
)
def
test_skipped
(
self
):
# Select number of emails to fit into a single subtask.
num_emails
=
settings
.
EMAILS_PER_TASK
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment