WIP: Remove warnings for public courses - #19624
Conversation
Shows "View Course" link to the course outline on the course about page, for courses marked public or public_outline. Makes course handouts public only for courses marked as public.
This fix hides the warnings for unenrolled users when the course is marked public and modifies the default public_view message to include display_name if exists.
|
Thanks for the pull request, @pkulkark! I've created OSPR-2996 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams. Feel free to add as much of the following information to the ticket:
All technical communication about the code itself will still be done via the GitHub pull request interface. As a reminder, our process documentation is here. |
SSPJ
left a comment
There was a problem hiding this comment.
This looks great Pooja! I've left a minor style comment and a question about functionality that you might know the answer to or might want to clarify with Jill.
I'm sorry to say that I don't know the issue with Jenkins. It may be the jobs aren't kicked off for wip PRs, but I'm sure Natalia when you are ready to ping her will know.
| # Save back any changes | ||
| if any(block_keys[changed] for changed in ('invalid', 'overlimit', 'added')): | ||
| if usage_info.user.is_authenticated() and any(block_keys[changed] | ||
| for changed in ('invalid', 'overlimit', 'added')): |
There was a problem hiding this comment.
How about refactoring the two line one-liner? Something like:
block_keys_changed = any(block_keys[changed] for changed in ('invalid', 'overlimit', 'added'))
if usage_info.user.is_authenticated() and block_keys_changed:
There was a problem hiding this comment.
This is from an earlier PR and was based on the review comments. Once that is merged, it won't show up here.
| ) | ||
| else: | ||
| if not CourseEnrollment.is_enrolled(request.user, course_key): | ||
| if not CourseEnrollment.is_enrolled(request.user, course_key) and not allow_anonymous: |
There was a problem hiding this comment.
Will this line prevent an unenrolled (but logged in) student from enrolling in the class?
There was a problem hiding this comment.
The idea is that there's no need for enrollment if the course is marked public. Marking a course as public would mean anybody, whether a registered student or not can access the course contents.
There was a problem hiding this comment.
Yup, I got that idea :) I just wondered if things like grades, etc, would be effected.
There was a problem hiding this comment.
Ah yes! As per the proposal #18134 , the parts of the course that contains exams and grading would not be allowed public access. Do you think having a message like below in the course landing page makes more sense in that case?

There was a problem hiding this comment.
I've thought about it and I think the answer is no. The message doesn't explain what parts of the course are hidden, leaving a student potentially confused about whether they should click the button or not. For now, let's assume that if a course is public, the instructor will explicitly invite any students who need to be enrolled for grading or exams.
| CourseHomeMessages.register_info_message( | ||
| request, | ||
| Text(_( | ||
| '{open_enroll_link}Enroll now{close_enroll_link} to access the full course.' |
There was a problem hiding this comment.
Same question as above. If a course is marked for public access, how do students enrol?
| if self.display_name: | ||
| display_text = DEFAULT_PUBLIC_VIEW_MESSAGE %self.display_name | ||
| else: | ||
| display_text = DEFAULT_PUBLIC_VIEW_MESSAGE %"This content" |
There was a problem hiding this comment.
This is not going to work with the translation system so you will need a string each for the two cases.
There was a problem hiding this comment.
@symbolist Would the translation work fine for this?
There was a problem hiding this comment.
Thanks. DEFAULT_PUBLIC_VIEW_MESSAGE will also need to be in a _() so that it gets translated. Also second sentence is missing a full-stop at the end. In case you haven't seen it, i18n docs should cover all the details.
There was a problem hiding this comment.
Thanks @symbolist . I've corrected it now.
3ad05f4 to
f5ca00a
Compare
|
Hi @natabene ! Is there a way to trigger the Jenkin checks for this PR? |
f5ca00a to
88765f6
Compare
|
👍 I think this is ready for edX review now, @pkulkark .
|
|
jenkins ok to test |
|
jenkins run all |
|
@edx/testeng Can you help us out with these tests? |
|
Your PR has finished running tests. The following contexts failed:
|
|
@pkulkark Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future. |
Work in progress : Do not merge. We will ping once our internal review is done.
This PR depends on #19385.
Description:
Currently the warnings show up for anonymous and unenrolled users irrespective of whether the course is marked public. This PR hides the different warnings and messages asking the user to sign-in and enroll in the course, when the course is marked public.
This PR also modifies the default public_view text to include the component display_name when unenrolled access is not available.
Sandbox server:
LMS: https://pr19624.sandbox.opencraft.hosting/
Studio: https://studio-pr19624.sandbox.opencraft.hosting/
Contains 2 course:
edX Demo Course has
seo.enable_anonymous_courseware_accesscourse waffle flag, and the "Advanced Settings > Course Visibility For Unenrolled Learners" set to private. Anonymous and unenrolled users can see the warning messages.Test Course has
seo.enable_anonymous_courseware_accesscourse waffle flag, and the "Advanced Settings > Course Visibility For Unenrolled Learners" set to public. Anonymous and unenrolled users should not see any of the warning messages. Unit-2 is a library content which does not have unenrolled access. The warning message should include the display_name (in this case, Randomised content block).Testing Instructions:
If testing on devstack, create a course and mark the course as public.
Access the course as an anonymous or unenrolled user. There should not be any warning messages asking the user to sign in or register or enroll in the course.
Add any content that does not support unenrolled access (library content for example) and access the course as an anonymous or unenrolled user. The warning message should contain the display_name if the component has one.