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

Matrix power level throws error in ad-hoc task

XMLWordPrintable

    • MOODLE_403_STABLE, MOODLE_404_STABLE
    • MOODLE_403_STABLE
    • MDL-80832-403
    • MDL-80832-main
    • Hide

      Setup

       # Clone Andrew's helper repository:

      git clone https://github.com/andrewnicols/moodle-synapse
      cd moodle-synapse
      chmod 777 *_data
      

       # Run the docker-compose up command:

      docker compose up -d
      

       # Wait for about 10 seconds for the first run to complete
       # Run the setup script:

      ./setup.sh
      

       # Copy the command it outputs
       # Change into your Moodle directory
       # Paste in the command, for EXAMPLE:

      cd path/to/moodle
      sed -i '/^require_once.*lib.*setup.php.*$/i require_once("/Users/nicols/git/moodlehq/synapse/moodle-config.php");' config.php
      cd -
      

       # If you have not done so already, edit your /etc/hosts file to add:

      127.0.0.1 element.container.docker.internal element
      127.0.0.1 synapse.container.docker.internal synapse
      127.0.0.1 keycloak.container.docker.internal keycloak
      

       # Follow the instructions at https://github.com/andrewnicols/moodle-synapse#trusting to trust the root CA that is used for this.

       

      Test Scenario

      1. Create a course
      2. Enrol a student and a teacher
      3. Go to More > Communication
      4. Set the Provider to 'Matrix'
      5. Save changes.
      6. Run the queued ad-hoc tasks by running cron from the command line php admin/cli/cron.php
      7. CONFIRM there are no errors outputted when running cron.
      8. Refresh your course page and go to your newly created Matrix room using the link/icon in the bottom right corner.
      9. Log in to Element using the user created during the setup (moodlebot) 
      10. CONFIRM that your course room has been created and that your teacher and student have been invited to the room (observe room feed).
      11. Navigate back to your course participant page
      12. Change the role of your teacher to a student.
      13. Run the queued ad-hoc tasks by running cron from the command line php admin/cli/cron.php
      14. CONFIRM there are no errors outputted when running cron.
      15. Go back to Element.
      16. CONFIRM that the teacher's power level has been changed to default  (observe room feed).
      Show
      Setup  # Clone Andrew's helper repository: git clone https://github.com/andrewnicols/moodle-synapse cd moodle-synapse chmod 777 *_data  # Run the docker-compose up command: docker compose up -d  # Wait for about 10 seconds for the first run to complete  # Run the setup script: ./setup.sh  # Copy the command it outputs  # Change into your Moodle directory  # Paste in the command, for EXAMPLE : cd path/to/moodle sed -i '/^require_once.*lib.*setup.php.*$/i require_once("/Users/nicols/git/moodlehq/synapse/moodle-config.php");' config.php cd -  # If you have not done so already, edit your /etc/hosts file to add: 127.0.0.1 element.container.docker.internal element 127.0.0.1 synapse.container.docker.internal synapse 127.0.0.1 keycloak.container.docker.internal keycloak  # Follow the instructions at https://github.com/andrewnicols/moodle-synapse#trusting to trust the root CA that is used for this.   Test Scenario Create a course Enrol a student and a teacher Go to More > Communication Set the Provider to 'Matrix' Save changes. Run the queued ad-hoc tasks by running cron from the command line php admin/cli/cron.php CONFIRM  there are no errors outputted when running cron. Refresh your course page and go to your newly created Matrix room using the link/icon in the bottom right corner. Log in to Element using the user created during the setup (moodlebot)  CONFIRM that your course room has been created and that your teacher and student have been invited to the room (observe room feed). Navigate back to your course participant page Change the role of your teacher to a student. Run the queued ad-hoc tasks by running cron from the command line php admin/cli/cron.php CONFIRM  there are no errors outputted when running cron. Go back to Element. CONFIRM that the teacher's power level has been changed to default  (observe room feed).
    • 2
    • Team Hedgehog 2024 Sprint 1.1

      When adding a user to a room, matrix api is used to set the power level of the user. Settings the power level throws the following error:

      Adhoc task failed: core_communication\task\add_members_to_room_task,Client error: `PUT https://synapse:8448/_matrix/client/v3/rooms/%21JDkeDDPkdLbjbZCdRy%3Asynapse/state/m.room.power_levels` resulted in a `400 Bad Request` response: {"errcode":"M_BAD_JSON","error":"\"@moodlebot:synapse\": [100] is not of type 'integer'"}Backtrace: * line 69 of /lib/guzzlehttp/guzzle/src/Middleware.php: call to GuzzleHttp\Exception\RequestException::create() * line 204 of /lib/guzzlehttp/promises/src/Promise.php: call to GuzzleHttp\Middleware::GuzzleHttp\{closure}() * line 153 of /lib/guzzlehttp/promises/src/Promise.php: call to GuzzleHttp\Promise\Promise::callHandler() * line 48 of /lib/guzzlehttp/promises/src/TaskQueue.php: call to GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}() * line 248 of /lib/guzzlehttp/promises/src/Promise.php: call to GuzzleHttp\Promise\TaskQueue->run() * line 224 of /lib/guzzlehttp/promises/src/Promise.php: call to GuzzleHttp\Promise\Promise->invokeWaitFn() * line 269 of /lib/guzzlehttp/promises/src/Promise.php: call to GuzzleHttp\Promise\Promise->waitIfPending() * line 226 of /lib/guzzlehttp/promises/src/Promise.php: call to GuzzleHttp\Promise\Promise->invokeWaitList() * line 62 of /lib/guzzlehttp/promises/src/Promise.php: call to GuzzleHttp\Promise\Promise->waitIfPending() * line 123 of /lib/guzzlehttp/guzzle/src/Client.php: call to GuzzleHttp\Promise\Promise->wait() * line 287 of /communication/provider/matrix/classes/matrix_client.php: call to GuzzleHttp\Client->send() * line 70 of /communication/provider/matrix/classes/local/spec/features/matrix/update_room_power_levels_v3.php: call to communication_matrix\matrix_client->execute() * line 651 of /communication/provider/matrix/classes/communication_feature.php: call to communication_matrix\local\spec\v1p1->update_room_power_levels() * line 186 of /communication/provider/matrix/classes/communication_feature.php: call to communication_matrix\communication_feature->set_matrix_power_levels() * line 248 of /communication/provider/matrix/classes/communication_feature.php: call to communication_matrix\communication_feature->create_members() * line 42 of /communication/classes/task/add_members_to_room_task.php: call to communication_matrix\communication_feature->add_members_to_room() * line 519 of /lib/classes/cron.php: call to core_communication\task\add_members_to_room_task->execute() * line 302 of /lib/classes/cron.php: call to core\cron::run_inner_adhoc_task() * line 128 of /lib/classes/cron.php: call to core\cron::run_adhoc_tasks() * line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()
      

       

      The issue might be getting the power level as an array, but needs more investigation on where it's going wrong and if it's an issue with the latest version of the matrix.

        1. screenshot-1.png
          screenshot-1.png
          103 kB
        2. screenshot-2.png
          screenshot-2.png
          97 kB
        3. screenshot-3.png
          screenshot-3.png
          99 kB
        4. screenshot-4.png
          screenshot-4.png
          102 kB

            david.woloszyn@moodle.com David Woloszyn
            safat.shahin@moodle.com Safat Shahin
            Safat Shahin Safat Shahin
            Huong Nguyen Huong Nguyen
            Mikel Martín Corrales Mikel Martín Corrales
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 5 hours, 13 minutes
                1d 5h 13m

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