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

Communication api throws error when its not set up but experimental feature is enabled

XMLWordPrintable

    • 1
    • Team Hedgehog 2024 Sprint 1.3, Team Hedgehog 2024 Sprint 1.4
    • Small

      There are a couple of cases where we try to use methods when there is no valid communication object yet. This throws an error.

      One such error can be created by doing the following:

      1. Enable Matrix experimental setting (don't touch the course communication settings yet)
      2. Create a new course with groups set to 'Separate groups'
      3. Create a group
      4. Enrol a student and observe error 'Exception - Call to a member function get_all_userids_for_instance() on null'

       

      There is another case that was discovered when developing for MDL-81333 and will require the newly added functionality to recreate the error, but the steps are similar to above:

      1. Enable Matrix experimental setting (don't touch the course communication settings yet)
      2. Create a new course with groups set to 'Separate groups'
      3. Create a group
      4. You should see an error saying 'Exception - Call to a member function get_room_name() on null'

      We need to check these providers/communication objects exist before attempting to use their containing methods.

      Note:
      It might be as simple as just checking there is a processor for the communication in certain locations:

      if (empty($communication->get_processor())) {
          return;
      }
      

            david.woloszyn@moodle.com David Woloszyn
            david.woloszyn@moodle.com David Woloszyn
            Stevani Andolo Stevani Andolo
            Safat Shahin Safat Shahin
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 25 minutes
                2h 25m

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