Fix: Video public view for anonymous users on public courses#38015
Closed
Fix: Video public view for anonymous users on public courses#38015
Conversation
- courseware/access: allow block and course load for anonymous on public courses - courseware/courses: do not redirect anonymous on StartDateError when public - course_home_api/outline: return empty completions for anonymous in navigation API - video_block: handle missing VideoBlockMain webpack bundle in public_view
94d5262 to
cae1786
Compare
Contributor
Author
|
Closing the PR as it was created for the testing purpose. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix video public view feature via vibe coding using Cursor and It needs to be critically reviewed
Below the LLM cursor generated PR description.
Fix: Video public view for anonymous users on public courses
Summary
Fixes the Learning MFE courseware experience for anonymous users on public courses with unenrolled access enabled. Previously the page either redirected to login or showed "An unexpected error occurred" where the video block should be. This PR fixes the underlying backend issues so the page loads and the video section renders.
Problem
BlockCompletion.objects.filter(user=self.request.user, ...)usedAnonymousUser, causingTypeError: Cannot cast AnonymousUser to int.WebpackBundleLookupError: Cannot resolve bundle VideoBlockMainwhen rendering the video block's public view.Solution
courseware/access.py)check_public_access(..., COURSE_VISIBILITY_PUBLIC)), without requiring enrollment or a user id.courseware/courses.py)StartDateError; allow them to reach the courseware.course_home_api/outline/views.py)CourseBlocksView.completions_dict, return an empty completion map whenrequest.user.is_anonymousso the navigation API never queriesBlockCompletionwithAnonymousUser.xmodule/video_block/video_block.py)public_view, catchWebpackBundleLookupErrorwhen adding theVideoBlockMainbundle and continue without the bundle so the fragment (HTML) still returns and the video area loads instead of returning 500.Preconditions
course_experience.course_enable_unenrolled_access) is enabled for the course or globally.Testing
.../learning/course/course-v1:org+course+run/block-v1:...).