Merge pull request #19837 from open-craft/opencraft/edx-platform/devan/show-enroll-links-on-public-courses-only-if-self-enrollment-allowed

Show enroll links on public courses only if self enrollment allowed
This commit is contained in:
David Ormsbee
2019-03-13 14:25:53 -04:00
committed by GitHub
3 changed files with 48 additions and 21 deletions

View File

@@ -551,7 +551,7 @@ class CourseTabView(EdxFragmentView):
else:
if not CourseEnrollment.is_enrolled(request.user, course.id) and not allow_anonymous:
# Only show enroll button if course is open for enrollment.
if course_open_for_self_enrollment(course.id):
if course_open_for_self_enrollment(course.id) and not course.invitation_only:
enroll_message = _(u'You must be enrolled in the course to see course content. \
{enroll_link_start}Enroll now{enroll_link_end}.')
PageLevelMessages.register_warning_message(