diff --git a/lms/djangoapps/discussion/rest_api/api.py b/lms/djangoapps/discussion/rest_api/api.py index 7123ca9e3fb4..100482ea56d1 100644 --- a/lms/djangoapps/discussion/rest_api/api.py +++ b/lms/djangoapps/discussion/rest_api/api.py @@ -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 = { diff --git a/lms/djangoapps/discussion/rest_api/tests/test_api.py b/lms/djangoapps/discussion/rest_api/tests/test_api.py index 62725cc47466..b26f594d98bd 100644 --- a/lms/djangoapps/discussion/rest_api/tests/test_api.py +++ b/lms/djangoapps/discussion/rest_api/tests/test_api.py @@ -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 @@ -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] ) @@ -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): @@ -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: