Unverified Commit ee7829a8 by Hasnain Naveed Committed by GitHub

Merge pull request #51 from edx/hasnain-naveed/WL-1403

WL-1403 | suppressing digest notification for WL-sites.
parents 6c35cf11 31c393b0
...@@ -69,6 +69,15 @@ def _build_digest(user_content, user_info): ...@@ -69,6 +69,15 @@ def _build_digest(user_content, user_info):
) )
) )
def _should_skip_org(course_id):
# TODO: Need to implement an end point in LMS to get this list.
orgs_to_skip = ["WhartonOnlineProfessionalEd"]
skip_course = False
for org in orgs_to_skip:
if org in course_id:
skip_course = True
return skip_course
def _build_digest_course(course_id, course_content, user_course_info): def _build_digest_course(course_id, course_content, user_course_info):
""" """
Transforms thread/item data from the comments service's response for a Transforms thread/item data from the comments service's response for a
...@@ -76,23 +85,26 @@ def _build_digest_course(course_id, course_content, user_course_info): ...@@ -76,23 +85,26 @@ def _build_digest_course(course_id, course_content, user_course_info):
The threads returned will be filtered by a group-level access check. The threads returned will be filtered by a group-level access check.
""" """
return DigestCourse( if _should_skip_org(course_id):
course_id, return DigestCourse(course_id, [])
[ else:
_build_digest_thread(thread_id, course_id, thread_content) return DigestCourse(
for thread_id, thread_content in course_content.iteritems() course_id,
if ( [
# the user is allowed to "see all cohorts" in the course, or _build_digest_thread(thread_id, course_id, thread_content)
user_course_info['see_all_cohorts'] or for thread_id, thread_content in course_content.iteritems()
if (
# the thread is not associated with a group, or # the user is allowed to "see all cohorts" in the course, or
thread_content.get('group_id') is None or user_course_info['see_all_cohorts'] or
# the user's cohort_id matches the thread's group_id # the thread is not associated with a group, or
user_course_info['cohort_id'] == thread_content.get('group_id') thread_content.get('group_id') is None or
)
] # the user's cohort_id matches the thread's group_id
) user_course_info['cohort_id'] == thread_content.get('group_id')
)
]
)
def _build_digest_thread(thread_id, course_id, thread_content): def _build_digest_thread(thread_id, course_id, thread_content):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment