Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lms/djangoapps/discussion/rest_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,10 @@ def get_thread_list(
except ValueError:
pass

if (group_id is None) and not context["has_moderation_privilege"]:
if (group_id is None) and (
not context["has_moderation_privilege"]
or request.user.id in context["ta_user_ids"]
):
group_id = get_group_id_for_user(request.user, CourseDiscussionSettings.get(course.id))

query_params = {
Expand Down
9 changes: 6 additions & 3 deletions lms/djangoapps/discussion/rest_api/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
FORUM_ROLE_COMMUNITY_TA,
FORUM_ROLE_MODERATOR,
FORUM_ROLE_STUDENT,
FORUM_ROLE_GROUP_MODERATOR,
Role
)
from openedx.core.lib.exceptions import CourseNotFoundError, PageNotFoundError
Expand Down Expand Up @@ -885,6 +886,7 @@ def test_thread_content(self):
FORUM_ROLE_MODERATOR,
FORUM_ROLE_COMMUNITY_TA,
FORUM_ROLE_STUDENT,
FORUM_ROLE_GROUP_MODERATOR,
],
[True, False]
)
Expand All @@ -897,7 +899,8 @@ def test_request_group(self, role_name, course_is_cohorted):
_assign_role_to_user(user=self.user, course_id=cohort_course.id, role=role_name)
self.get_thread_list([], course=cohort_course)
actual_has_group = "group_id" in httpretty.last_request().querystring # lint-amnesty, pylint: disable=no-member
expected_has_group = (course_is_cohorted and role_name == FORUM_ROLE_STUDENT)
expected_has_group = (course_is_cohorted and
role_name in (FORUM_ROLE_STUDENT, FORUM_ROLE_COMMUNITY_TA, FORUM_ROLE_GROUP_MODERATOR))
assert actual_has_group == expected_has_group

def test_pagination(self):
Expand Down Expand Up @@ -1787,10 +1790,10 @@ def test_call_with_paginated_results(self, page):

if page in (1, 2):
assert response.data["pagination"]["next"] is not None
assert f"page={page+1}" in response.data["pagination"]["next"]
assert f"page={page + 1}" in response.data["pagination"]["next"]
if page in (2, 3):
assert response.data["pagination"]["previous"] is not None
assert f"page={page-1}" in response.data["pagination"]["previous"]
assert f"page={page - 1}" in response.data["pagination"]["previous"]
if page == 1:
assert response.data["pagination"]["previous"] is None
if page == 3:
Expand Down