From aa8b315c58b3ec8bb3856707e9bfc0a02e7b5c07 Mon Sep 17 00:00:00 2001 From: Ghassan Maslamani Date: Mon, 26 Aug 2024 08:42:33 +0200 Subject: [PATCH] fix: course outline now working for MFE This changes fixes the case when: 1. The course visbility in studio advance settings is set to 'none'. 2. The `COURSE_ABOUT_VISIBILITY_PERMISSION` is set `see_about_page`. The fix is done by assuming that whenever a learner is accsing course content and they are **enrolled**, then we use 'load' action for them see (course detail/course outline), as oppiste to the default which would use `COURSE_ABOUT_VISIBILITY_PERMISSION` no matter if learner enrolled or not enrolled. Note this change dosn't affect the log `course-id/about` page at all, since that view doesn't use this view. --- lms/djangoapps/course_api/api.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/course_api/api.py b/lms/djangoapps/course_api/api.py index 8210396441c7..a5c2b175fae9 100644 --- a/lms/djangoapps/course_api/api.py +++ b/lms/djangoapps/course_api/api.py @@ -75,8 +75,12 @@ def course_detail(request, username, course_key): user = get_effective_user(request.user, username) overview = get_course_overview_with_access( user, - get_permission_for_course_about(), - course_key, + action=( + "load" + if CourseEnrollment.is_enrolled(request.user, course_key) + else get_permission_for_course_about() + ), + course_key=course_key, ) overview.effective_user = user return overview