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

Refactor core/fetch

XMLWordPrintable

    • MOODLE_405_STABLE
    • MOODLE_405_STABLE
    • MDL-82778-main
    • Hide
      1. Log in as any user
      2. Close the Block Drawer
      3. Refresh the page
        1. Confirm that the block drawer is closed
      4. Open the Block Drawer
      5. Refresh the page
        1. Confirm that the block drawer is open
      6. Open browser console and select "Console"
      7. Run:

        require('core_user/repository').getUserPreferences().then(console.log)
        

        1. Confirm you see a list of key/value pairs
      8. Run:

        require('core_user/repository').getUserPreference('drawer-open-block').then(console.log)
        

        1. Confirm you see the value of the preference (either 0 or 1)
      9. Run

        require('core_user/repository').setUserPreference('drawer-open-block', "0").then(console.log)
        require('core_user/repository').getUserPreference('drawer-open-block').then(console.log)
        

        1. Confirm the returned value was "0"
      10. Run

        require('core_user/repository').setUserPreference('drawer-open-block', "1").then(console.log)
        require('core_user/repository').getUserPreference('drawer-open-block').then(console.log)
        

        1. Confirm the returned value was "1"
      Show
      Log in as any user Close the Block Drawer Refresh the page Confirm that the block drawer is closed Open the Block Drawer Refresh the page Confirm that the block drawer is open Open browser console and select "Console" Run: require('core_user/repository').getUserPreferences().then(console.log) Confirm you see a list of key/value pairs Run: require('core_user/repository').getUserPreference('drawer-open-block').then(console.log) Confirm you see the value of the preference (either 0 or 1) Run require('core_user/repository').setUserPreference('drawer-open-block', "0").then(console.log) require('core_user/repository').getUserPreference('drawer-open-block').then(console.log) Confirm the returned value was "0" Run require('core_user/repository').setUserPreference('drawer-open-block', "1").then(console.log) require('core_user/repository').getUserPreference('drawer-open-block').then(console.log) Confirm the returned value was "1"

      During investigation of MDL-82652 I found a way to create a standardised API for batch and serialised requests but this requires a breaking change to the core/fetch module. This is safe to do before the 4.5 release but cannot be done after that point.

      Currently we export individaul methods and they can be imported individually if desired.
      The change proposed moves them to an ESM class which means that they can not be individually imported.

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Paul Holden Paul Holden
            Jake Dallimore Jake Dallimore
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 53 minutes
                3h 53m

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