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

Modals broken in mod_lti, analytics

    XMLWordPrintable

Details

    • MOODLE_403_STABLE
    • MOODLE_403_STABLE
    • MDL-79384-master
    • Hide

      Testing the LTI modal

      1. Ensure your site is using a public URL (e.g. ngrok)
      2. Go to "Site admin > Plugins > Activities > External tool > Manage tools"
      3. Enter 'https://robotest.theedtech.dev/register' into the "Tool URL..." input and press "Add LTI Advantage"
      4. Proceed to add the tool so that you end up back on the "Manage tools" page
      5. Click the "View configuration details" icon inside the tool card
        Verify:
        • You see a modal containing the tool configuration details
        • The modal has two buttons "Email" and "Cancel" in the footer
        • Clicking "Cancel" will close the modal
        • Clicking email will try to open up a mail client (you can just cancel that process)
      Show
      Testing the LTI modal Ensure your site is using a public URL (e.g. ngrok) Go to "Site admin > Plugins > Activities > External tool > Manage tools" Enter 'https://robotest.theedtech.dev/register' into the "Tool URL..." input and press "Add LTI Advantage" Proceed to add the tool so that you end up back on the "Manage tools" page Click the "View configuration details" icon inside the tool card Verify : You see a modal containing the tool configuration details The modal has two buttons "Email" and "Cancel" in the footer Clicking "Cancel" will close the modal Clicking email will try to open up a mail client (you can just cancel that process)

    Description

      This is a regression caused by MDL-78324, where these were changed, but not tested.

      To replicate in LTI:

      1. Go to "Site admin > Plugins > Activities > External tool > Manage tools"
      2. Enter 'https://robotest.theedtech.dev/register' into the "Tool URL..." input and press "Add LTI Advantage"
      3. Proceed to add the tool so that you end up back on the "Manage tools" page
      4. Click the "Tool configuration details" icon inside the tool card
        Expected: It works and you see a modal containing all the platform endpoints etc, which buttons to cancel and email
        Actual: Nothing happens

      There seem to be a few issues here:

      1. The code passes the wrong number of args to Modal.create(). It takes 1, not 2. - the same problem is in analytics code.
      2. There is no click handler to actually create this modal (which used to be done via the trigger param, which no longer exists)
      3. Fixing the above 2 reveals there is a problem with the way the footer is being set, when passed in as a promise, specifically when the modal is set to display immediately. We didn't see this before, perhaps because the modal was created a different way in the LTI code. Essentially, in modal.configure(), setFooter() is called before show(), as in this code:
        https://github.com/moodle/moodle/blob/a54ba682a4b73af116b0e01e56568d02ff1d590f/lib/amd/src/modal.js#L259-L266
        but the footer promise can resolve after show() is called. Importantly, the logic controlling the visibility of the footer lives inside show() and will have already run at this point. This results in the modal hiding the footer since it thinks it's empty, then the promise resolves and the footer html is set, but it's too late as the show/hide footer logic has already run.

      Attachments

        Issue Links

          Activity

            People

              jaked Jake Dallimore
              jaked Jake Dallimore
              Paul Holden Paul Holden
              Ilya Tregubov Ilya Tregubov
              Ron Carl Alfon Yu Ron Carl Alfon Yu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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

                  Clockify

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