Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-77645

Course Editor JS error when student tries to access course while enrolment method is disabled

    XMLWordPrintable

Details

    Description

      I figured out that there's a bug in (at least) Moodle 4.1.2 which occurs when I do the following:

      1. Create a course
      2. Enrol a student to a course
      3. Disable the enrolment method
      4. Try to open the course page as student
      5. The page is rendered correctly, but in the console of the browser, the following exception occurs: 

      I also wrote a small Behat script that helps to reproduce / cover this scenario:

      @javascript @enrolment_test
      Feature: title
          In order to value
          As a role
          I want feature    Scenario: Test
              Given the following "users" exist:
                  | username | firstname | lastname |
                  | student  | Student   | 1        |
              And the following "courses" exist:
                  | fullname | shortname |
                  | Course 1 | C1        |
              And I log in as "admin"
              And I am on "Course 1" course homepage
              And I navigate to course participants
              And I enrol "Student 1" user as "Student"
              And I am on the "Course 1" "Enrolment methods" page
              And I click on "Disable" "icon" in the "Manual enrolments" "table_row"
              Then I log out
              And I log in as "student"
              And I am on "Course 1" course homepage
              Then I should see "You cannot enrol yourself in this course."

      When you run this scenario, Behat finally fails with the following error (because of the exception):

      Javascript code and/or AJAX requests are not ready after 10 seconds. There is a Javascript error or the code is extremely slow (core/reactive:registerInstance1:core_courseformat/placeholder:loadcourseindex:core/reactive:registerComponent3:core/reactive:registerComponent5). If you are using a slow machine, consider setting $CFG->behat_increasetimeout. (Exception) 

      Attachments

        Issue Links

          Activity

            People

              pholden Paul Holden
              mstimvol Tim Volckmann
              Laurent David Laurent David
              Andrew Lyons Andrew Lyons
              Ron Carl Alfon Yu Ron Carl Alfon Yu
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 51 minutes
                  1h 51m

                  Clockify

                    Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.