Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Threads API call is failing for cohort users #142

Open
muhammadadeeltajamul opened this issue Jan 10, 2025 · 5 comments
Open

Threads API call is failing for cohort users #142

muhammadadeeltajamul opened this issue Jan 10, 2025 · 5 comments
Assignees
Labels
bug Report of or fix for something that isn't working as intended release blocker Blocks the upcoming release (fix needed)

Comments

@muhammadadeeltajamul
Copy link

Threads API call is failing for users enrolled in course divided by cohort.

How to reproduce:

  • Create a course with cohorts
  • Enable discussions divided by cohort in course authoring
  • Enroll as learner in course
  • Go to All Posts tab in discussions
  • api/discussion/v1/threads/ API call will fail with status 500

This call is failing

  • For all users (not just learner role) who are restricted to view posts of their specific cohort
  • When a discussion moderator filters a post by cohort
@regisb
Copy link
Contributor

regisb commented Jan 10, 2025

Do you have a stacktrace of the server error?

@muhammadadeeltajamul
Copy link
Author

I am attaching stack trace here. "Following" filter is also failing for some users with similar stack trace

Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.11/site-packages/ddtrace/contrib/trace_utils.py", line 336, in wrapper
    return func(mod, pin, wrapped, instance, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.11/site-packages/ddtrace/contrib/internal/django/patch.py", line 333, in wrapped
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.11/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.11/site-packages/ddtrace/contrib/trace_utils.py", line 336, in wrapper
    return func(mod, pin, wrapped, instance, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.11/site-packages/ddtrace/contrib/internal/django/patch.py", line 333, in wrapped
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/rest_api/views.py", line 636, in list
    return get_thread_list(
           ^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/discussion/rest_api/api.py", line 1023, in get_thread_list
    paginated_results = Thread.search(query_params)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/edx-platform/openedx/core/djangoapps/django_comment_common/comment_client/thread.py", line 83, in search
    response = forum_api.get_user_threads(**params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: get_user_threads() got an unexpected keyword argument 'group_id'

@muhammadadeeltajamul muhammadadeeltajamul added bug Report of or fix for something that isn't working as intended release blocker Blocks the upcoming release (fix needed) labels Jan 14, 2025
@Ali-Salman29
Copy link
Contributor

Ali-Salman29 commented Jan 14, 2025

Thank you, @muhammadadeeltajamul. The group_id parameter is missing from the function definition; however, we are using it in the corresponding calls! I'll create the PR to resolve this issue.

Ali-Salman29 added a commit that referenced this issue Jan 15, 2025
The PR contains a fix for the issue mentioned in the PR #142

close #142
Ali-Salman29 added a commit that referenced this issue Jan 16, 2025
The PR contains a fix for the issue mentioned in the PR #142

close #142
Ali-Salman29 added a commit that referenced this issue Jan 16, 2025
The PR contains a fix for the issue mentioned in the PR #142

close #142
@muhammadadeeltajamul
Copy link
Author

On latest edx-platform pull this issue still exists. Steps to reproduce

  • Take latest pull of edx-platform (forum version is 0.1.6)
  • Run make requirements in lms container
  • Open All Posts tab in discussions mfe from learner role

@taimoor-ahmed-1
Copy link
Contributor

I have assigned this to myself, will share an update here soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report of or fix for something that isn't working as intended release blocker Blocks the upcoming release (fix needed)
Projects
None yet
Development

No branches or pull requests

4 participants