MDL-77645 course: ensure active enrolments are considered for drawer.

Otherwise the enrolment index page tries to load the course index
drawer, which doesn't exist at this point and triggers exceptions in
the editor module.

Co-authored-by: Tim Volckmann <[email protected]>
This commit is contained in:
Paul Holden
2023-07-12 14:35:23 +01:00
co-authored by Tim Volckmann
parent 2ef6a3b9b9
commit 6bdf4bb2b1
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -3768,7 +3768,7 @@ function core_course_drawer(): string {
}
// Show course index to users can access the course only.
if (!can_access_course($PAGE->course)) {
if (!can_access_course($PAGE->course, null, '', true)) {
return '';
}
@@ -102,3 +102,11 @@ Feature: Restricting access to course lists
And I follow "Biology Y1"
And I should see "You cannot enrol yourself in this course."
And I log out
@javascript
Scenario: Browse courses as a user who has a disabled enrolment in them
Given the following "course enrolments" exist:
| user | course | role | status |
| usere | ENG1 | student | 1 |
When I am on the "ENG1" course page logged in as usere
Then I should see "You cannot enrol yourself in this course."