Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
41fcd962
Commit
41fcd962
authored
Oct 08, 2013
by
Brian Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't send emails to students who haven't activated.
parent
eaec962d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
lms/djangoapps/bulk_email/tasks.py
+3
-0
lms/djangoapps/bulk_email/tests/test_tasks.py
+13
-0
No files found.
lms/djangoapps/bulk_email/tasks.py
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
)
...
...
lms/djangoapps/bulk_email/tests/test_tasks.py
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment