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

Badges ajax scripts should be managing output and headers in a better way

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.5.2, 2.6
    • Fix Version/s: 2.5.3
    • Component/s: Badges
    • Labels:
    • Testing Instructions:
      Hide

      This fix doesn't really fix a bug, but rather improves the way page headers are handled. So, by testing, we just need to make sure that nothing is broken.

      For the first 2 tests, your need to be able to push badges to the backpack (i.e. your web site should be accessible from the Internet). You need a user with any local badge earned and a user backpack connected.

      1. For testing changes in assertion.php: Login as a user and add this issued badge to your Mozilla backpack. Badge should be successfully added to the backpack. Check page headers while adding a badge to make sure that JSON is sent.

      2. For testing changes in backpackconnect.php: Try to connect and disconnect user backpack. Everything should work as before, and if user has a backpack account, it should be connected. It would be difficult to check page headers as the page is reloaded once backpack is connected. But it you can watch the headers while backpack is connecting, check backpackconnect.php for JSON headers.

      3. For testing changes in ajax.php: Login as admin. Go to Site Admin > Badges > Manage Badges. Check your browser for headers sent by ajax.php. Make sure they are of a type JSON.

      I have attached examples of page headers.

      Show
      This fix doesn't really fix a bug, but rather improves the way page headers are handled. So, by testing, we just need to make sure that nothing is broken. For the first 2 tests, your need to be able to push badges to the backpack (i.e. your web site should be accessible from the Internet). You need a user with any local badge earned and a user backpack connected. 1. For testing changes in assertion.php: Login as a user and add this issued badge to your Mozilla backpack. Badge should be successfully added to the backpack. Check page headers while adding a badge to make sure that JSON is sent. 2. For testing changes in backpackconnect.php: Try to connect and disconnect user backpack. Everything should work as before, and if user has a backpack account, it should be connected. It would be difficult to check page headers as the page is reloaded once backpack is connected. But it you can watch the headers while backpack is connecting, check backpackconnect.php for JSON headers. 3. For testing changes in ajax.php: Login as admin. Go to Site Admin > Badges > Manage Badges . Check your browser for headers sent by ajax.php. Make sure they are of a type JSON. I have attached examples of page headers.
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-42072_master

      Description

      This is an issue that was introduced with MDL-40572

      badges/assertion.php should be managing headers and output better than it currently is.
      Perhaps the easiest way would be to simply define AJAX_SCRIPT at the top of the file, if not then lets copy the headers we need here and define things such that debugging and exception handling is minimised for this script.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Nov/13