openedx / wg-build-test-release

Open edX Build / Test / Release Working Group
25 stars 15 forks source link

[Test failure] < TC_AUTHOR_146 >: Cannot request course creator permission #428

Open angonz opened 1 day ago

angonz commented 1 day ago

Release

Sumac

Expected behavior

A regular user (non staff, non superuser) should be able to request course creator permission after logging into Studio.

Actual behavior

Studio home page displays "Failed to fetch courses. Please try again later." No button to request course creator permission is shown.

image

Steps to reproduce

Go to https://studio.sumac.demo.edly Login with "student" user You should be redirected to https://apps.sumac.demo.edly.io/authoring/home

Additional information

No response

mariajgrimaldi commented 1 day ago

I could reproduce this in the sandbox with a brand-new user. This endpoint is raising a 500 error: https://studio.sumac.demo.edly.io/api/contentstore/v2/home/courses?page=1&order=display_name

I already asked the sandbox maintainer for server logs so we can know more.

EDIT: @DawoudSheraz, if you can, please paste the logs in this thread. Thank you!

mariajgrimaldi commented 1 day ago

I know what’s wrong because I implemented the feature that’s failing. I’m working on fixing it now, and thankfully, it’s easy to solve. I'll let you know once I have a PR.

DawoudSheraz commented 1 day ago

Stack trace

cms-1                   | 2024-12-02 16:04:38,804 ERROR 23 [root] [user None] [ip None] signals.py:22 - Uncaught exception from None
cms-1                   | Traceback (most recent call last):
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
cms-1                   |     response = get_response(request)
cms-1                   |                ^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
cms-1                   |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
cms-1                   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/opt/pyenv/versions/3.11.8/lib/python3.11/contextlib.py", line 81, in inner
cms-1                   |     return func(*args, **kwds)
cms-1                   |            ^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
cms-1                   |     return view_func(*args, **kwargs)
cms-1                   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
cms-1                   |     return self.dispatch(request, *args, **kwargs)
cms-1                   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
cms-1                   |     response = self.handle_exception(exc)
cms-1                   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
cms-1                   |     self.raise_uncaught_exception(exc)
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
cms-1                   |     raise exc
cms-1                   |   File "/openedx/venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
cms-1                   |     response = handler(request, *args, **kwargs)
cms-1                   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/rest_api/v2/views/home.py", line 136, in get
cms-1                   |     courses, in_process_course_actions = get_course_context_v2(request)
cms-1                   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/utils.py", line 1666, in get_course_context_v2
cms-1                   |     courses_iter, in_process_course_actions = get_courses_accessible_to_user(request, org)
cms-1                   |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/opt/pyenv/versions/3.11.8/lib/python3.11/contextlib.py", line 81, in inner
cms-1                   |     return func(*args, **kwds)
cms-1                   |            ^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/views/course.py", line 770, in get_courses_accessible_to_user
cms-1                   |     courses, in_process_course_actions = _accessible_courses_list_from_groups(request)
cms-1                   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/views/course.py", line 580, in _accessible_courses_list_from_groups
cms-1                   |     courses_list = get_filtered_and_ordered_courses(
cms-1                   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/views/course.py", line 485, in get_filtered_and_ordered_courses
cms-1                   |     course_overviews = get_courses_order_by(order, course_overviews)
cms-1                   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   |   File "/openedx/edx-platform/cms/djangoapps/contentstore/views/course.py", line 627, in get_courses_order_by
cms-1                   |     return course_overviews.order_by(order_query)
cms-1                   |            ^^^^^^^^^^^^^^^^^^^^^^^^^
cms-1                   | AttributeError: 'list' object has no attribute 'order_by'
mariajgrimaldi commented 1 day ago

Here's the PR that fixes this issue: https://github.com/openedx/edx-platform/pull/35942