-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Show enroll links on public courses only if self enrollment allowed #19837
Show enroll links on public courses only if self enrollment allowed #19837
Conversation
Thanks for the pull request, @DevanR! I've created OSPR-3099 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. |
@DevanR Thank you for your contribution. Please let me know once checks pass and this is ready for our review. |
openedx/features/course_experience/tests/views/test_course_home.py
Outdated
Show resolved
Hide resolved
openedx/features/course_experience/views/course_home_messages.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this done @DevanR ! Just a couple more things to take care of. Also, can you provide a brief (one-liner) description for each of the screenshots?
openedx/features/course_experience/views/course_home_messages.py
Outdated
Show resolved
Hide resolved
openedx/features/course_experience/tests/views/test_course_home.py
Outdated
Show resolved
Hide resolved
openedx/features/course_experience/tests/views/test_course_home.py
Outdated
Show resolved
Hide resolved
@marcotuts Would you like to give it a first look? |
if enable_unenrolled_access and course_visibility == COURSE_VISIBILITY_PUBLIC: | ||
if user_type == CourseUserType.UNENROLLED and self.course.invitation_only: | ||
if expected_enroll_message: | ||
self.assertContains(response, 'You must be enrolled in the course to see course content.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message text to be checked is You should be enrolled in the course to fully access the contents.
It looks like this is not getting checked since the course's invitation_only
is set to False
. Is it possible to set the invitation_only
to True
and fetch the response again before this step? If not, you can create a new course like you did earlier with invitation_only
set to True
(but no need to add a new ddt data). Note that if you create a new course, you will need to add a check for invitation_only
in https://github.com/edx/edx-platform/blob/master/openedx/features/course_experience/tests/views/test_course_home.py#L668 and https://github.com/edx/edx-platform/blob/master/openedx/features/course_experience/tests/views/test_course_home.py#L675.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. I can creat a private course in the setup and make sure that test uses the reponse from that. In that way I will not need to modify any other tests.
if enable_unenrolled_access and course_visibility == COURSE_VISIBILITY_PUBLIC:
if user_type == CourseUserType.UNENROLLED and self.private_course.invitation_only:
if expected_enroll_message:
self.assertContains(private_response, 'You should be enrolled in the course to fully access the contents.')
Is this ok with you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup that should be fine. Make sure you handle the check in the other two lines mentioned in my previous comment as well. Otherwise the test cases will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and the additional tests you mentioned don't actually fail. It's becaue those tests are not using the private course (self.private_course) but are using the public one (self.course). Anyways, I'm pushing the changes to do a full run of tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah perfect! I missed that. Thanks.
@DevanR - Quick product input and questions here.
Previous to adding this message / banner in 2017 (?) we forced login for learners attempting to access the course home or course content pages. Is providing any level of visibility into an invite only-course's home page what we should do for invite only? Perhaps we should just jump to the earlier redirect rules for invite only courses? Any challenges with this approach? |
@marcotuts Not sure if this covers what you're asking, but it depends on what the course visibility is set to. By default, it will be set to |
@DevanR Thanks for getting this done! I have reviewed and tested on the sandbox. It looks good to me. Can you format the course links properly in the testing instructions? Looks like you put them within triple quotes (```) which are disabling the actual formatting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I tested this by setting the course visibility to public and enabling invitation_only and verified that the correct messages are displayed.
- I read through the code
- I checked for accessibility issues. N/A.
- Includes documentation
@natabene This is good for a review now. |
@pkulkark Will do that and update OCIM instances. |
06778f0
to
89aadfa
Compare
@marcotuts Are you ok with moving this to engineering review? |
Thank you @marcotuts and @DevanR ! FYI @natabene , @ormsbee has been doing the engineering reviews for these Anonymous Courseware tickets, so it would be great if he has time to look at this one too. We're hoping to get this into Ironwood as well since it's technically a bugfix, but of course is up to @nedbat . |
@ormsbee Could you give this a look? |
openedx/features/course_experience/views/course_home_messages.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please squash your commits and mention invitation_only
in your commit message (I don't think most people know what controls self-enrollment).
Thank you. And thank you to @pomegranited for making the only change request that I would have (the text update).
This commit updates the Info messages on the course page to display more informative messages to the user. Specifically, messages for Public and Invitation-only courses.
13ed3af
to
c6f87d4
Compare
jenkins run bokchoy |
Thanks for your review @ormsbee -- I think these bokchoy failures are flaky tests, but unrelated to this code change:
Is this ok to merge? |
jenkins run bokchoy |
Yeah. I was worried because I saw the failing test was |
Your PR has finished running tests. There were no failures. |
@DevanR 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production on Thursday, March 14, 2019. |
EdX Release Notice: This PR may have caused e2e tests to fail on Stage. If you're a member of the edX org, please visit #e2e-troubleshooting on Slack to help diagnose the cause of these failures. Otherwise, it is the reviewer's responsibility. E2E tests have failed. https://gocd.tools.edx.org/go/tab/pipeline/history/STAGE_edxapp_M-D |
EdX Release Notice: This PR has been deployed to the production environment. |
This PR changes the logic for displaying enroll messages on the course home page.
With this change, public courses will show "Enroll" links only if self-enrollment is allowed
Discussions: Link to any public dicussions about this PR or the design/architecture. Otherwise omit this.
Screenshots:
View when User is unenrolled for Public Outline course (invite-only), before change.
View when User is unenrolled for Public Outline course (invite-only), after change.
View when User is unenrolled for Public course (self-enrollment allowed), before change.
View when User is unenrolled for Public course (self-enrollment allowed), after change.
View when User is anonymous for Public course (self-enrollment allowed), before change.
View when User is anonymous for Public course (self-enrollment allowed), after change.
Sandbox URL:
Studio:https://studio-pr19837.sandbox.opencraft.hosting/
LMS:https://pr19837.sandbox.opencraft.hosting/
Merge deadline:"None"
Testing instructions:
Contains 2 courses:
[edX Demo Course] has
seo.enable_anonymous_courseware_access
course waffle flag, and the "Advanced Settings > Course Visibility For Unenrolled Learners" set to public_outline and the "Advanced Settings > Invitation Only " set to true.https://pr19837.sandbox.opencraft.hosting/courses/course-v1:edX+DemoX+Demo_Course/
[Test Course] has
seo.enable_anonymous_courseware_access
course waffle flag, and the "Advanced Settings > Course Visibility For Unenrolled Learners" set to public and the "Advanced Settings > Invitation Only " set to false.https://pr19837.sandbox.opencraft.hosting/courses/course-v1:opencraft+test01+2019_T1/
Go to LMS
Sign in
View the edX Demo Course course page
You should not see an Enroll message
Go to LMS
Sign in
View the Test Course course page of the public course you've created
You should see an Enroll message
Open the same link in an anonymous browser
You should not see an Enroll message
Reviewers
Settings