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

URL's should still work after saving, eg admin settings / search pages

XMLWordPrintable

    • MOODLE_30_STABLE, MOODLE_31_STABLE
    • MOODLE_31_STABLE
    • MDL-53357-dont-break-urls
    • Hide
      1. go to all of the urls below in the list, and save them. The resulting url should not change, you should be able to copy and paste it and for it to work.

      http://moodle.local/admin/search.php?query=inbound
      http://moodle.local/admin/settings.php?section=messageinbound_mailsettings

      There is actually 3 processes to test for both classes of urls above:

      1) Test saving with values that pass validation - this should save and then redirect to the GET version + success notification
      2) Test saving with values that fail validation - this should be the normal post, but still with correct url + fail notification
      3) Test saving with values that haven't changes - should save nothing then redirect with no notification (which almost feels like an omission)

      Show
      go to all of the urls below in the list, and save them. The resulting url should not change, you should be able to copy and paste it and for it to work. http://moodle.local/admin/search.php?query=inbound http://moodle.local/admin/settings.php?section=messageinbound_mailsettings There is actually 3 processes to test for both classes of urls above: 1) Test saving with values that pass validation - this should save and then redirect to the GET version + success notification 2) Test saving with values that fail validation - this should be the normal post, but still with correct url + fail notification 3) Test saving with values that haven't changes - should save nothing then redirect with no notification (which almost feels like an omission)

      There are a large class of pages in moodle which after you perform some action end up at a url which isn't a valid url, but where there is actually a url that represents that resource.

      A few examples:

      http://moodle.local/admin/settings.php?section=messageinbound_mailsettings

      after a save becomes:

      http://moodle.local/admin/settings.php

      which if you try to load as a get request will fail. There are multiple situations where this manifests itself:

      1) If a browser is closed and reopens with sessions retained, it will http 'get' the page (it won't attempt to re-post)
      2) You are on a previously posted page, and just hit enter in the url bar to reload it (you want to load the page, not re-post)
      3) You want to cut and paste the url to share with someone, or are using a url syncing browser plugin

      Some web frameworks get around this by always doing a http POST followed by a redirect to GET page which can be safely reloaded. A simpler hybrid strategy is to duplicate the 'view' get parameters into the form post action, which also saves a redirect so is faster.

            brendanheywood Brendan Heywood
            brendanheywood Brendan Heywood
            Simey Lameze Simey Lameze
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Frédéric Massart Frédéric Massart
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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