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

Avatar setting should reference a stored file

XMLWordPrintable

    • MOODLE_403_STABLE
    • MOODLE_403_STABLE
    • MDL-78738-master
    • Hide

      Setup

      1. Clone Andrew's helper repository:

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

      2. Run the docker-compose up command:

        docker compose up -d
        

      3. Wait for about 10 seconds for the first run to complete
      4. Run the setup script:

        ./setup.sh
        

      5. Copy the command it outputs
      6. Change into your Moodle directory
      7. 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 -
        

      8. 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
        

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

      Test

      1. Run cron in the CLI:

        while true ; do php admin/cli/cron.php; done
        

      2. In your browser, navigate to https://element:8081/
      3. Log in with:
        1. username: moodlebot
        2. password: password
      4. In a new tab, login to your Moodle site as admin
      5. Navigate to a course
      6. Edit its settings
      7. Open the "Communication" section
      8. Enable Matrix, giving it a room name and topic
      9. Wait a few seconds (should be almost instant)
      10. Open Element
        1. Confirm that the room was created
        2. Confirm that the room has no avatar
      11. Edit the course settings again
      12. Add a course image
      13. Save the settings page
      14. Wait a few seconds (should be almost instant)
      15. Open Element
        1. Confirm that the room avatar is the image you set
      16. Edit the course settings again
      17. Delete the course image and add a different image
      18. Save the settings page
      19. Wait a few seconds (should be almost instant)
      20. Open Element
        1. Confirm that the room avatar is the image you set
      21. Edit the course settings again
      22. Delete the course image entirely
      23. Save the settings page
      24. Wait a few seconds (should be almost instant)
      25. Open Element
        1. Confirm that the room avatar was removed
      26. Open a different course
      27. Edit its settings, and set:
        1. A course image
        2. Enable the communication API with a new room name and topic
      28. Save changes
      29. Wait a few seconds (should be almost instant)
      30. Open Element
        1. Confirm that the room was created
        2. Confirm that the room has the avatar that you set
      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 Run cron in the CLI: while true ; do php admin/cli/cron.php; done In your browser, navigate to https://element:8081/ Log in with: username: moodlebot password: password In a new tab, login to your Moodle site as admin Navigate to a course Edit its settings Open the "Communication" section Enable Matrix, giving it a room name and topic Wait a few seconds (should be almost instant) Open Element Confirm that the room was created Confirm that the room has no avatar Edit the course settings again Add a course image Save the settings page Wait a few seconds (should be almost instant) Open Element Confirm that the room avatar is the image you set Edit the course settings again Delete the course image and add a different image Save the settings page Wait a few seconds (should be almost instant) Open Element Confirm that the room avatar is the image you set Edit the course settings again Delete the course image entirely Save the settings page Wait a few seconds (should be almost instant) Open Element Confirm that the room avatar was removed Open a different course Edit its settings, and set: A course image Enable the communication API with a new room name and topic Save changes Wait a few seconds (should be almost instant) Open Element Confirm that the room was created Confirm that the room has the avatar that you set
    • 2
    • Team Hedgehog 2023 Review 2

      The avatar setting currently uses a pluginfile url to then re-fetch a file already in Moodle and store it again.

      This leads to a couple of issues:

      • unnecessary fetches against self (which may have hairpin NAT issues in some installations)
      • the mimetype of the file was hardcoded to image/png when it could actually be any kind of image

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Safat Shahin Safat Shahin
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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