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

Mark-notification-read JS breaks some URLs

    XMLWordPrintable

    Details

      Description

      We have a client who has some code syncing notifications between their Moodle and their Mahara - and the Mahara notifications are sent over to Moodle, setting up their contexturl as an MNET jump link. This way, clicking on the notification in Moodle takes you to the equivalent notification in Mahara where you can get extra detail on it.

      Unfortunately with the changes in MDL-56498, the link is no longer being handled correctly.

      The raw link as in the database takes the form of: http://moodle/auth/mnet/jump.php?hostid=3&wantsurl=module%2Fmultirecipientnotification%2Finbox.php%3Fmsg%3D88%26msgtype%3Dnotification_internal_activity

      Note the & after the hostid is encoded as & though this is not problematic.

      But once the URL has been rewritten by the notification code, it takes the form: http://moodle/message/output/popup/mark_notification_read.php?notificationid=4&redirecturl=http://moodle/auth/mnet/jump.php?hostid=3&wantsurl=module%2Fmultirecipientnotification%2Finbox.php%3Fmsg%3D88%26msgtype%3Dnotification_internal_activity

      The additional parameters in the link are not encoded, so wantsurl is not a parameter for MNET, but instead treated as a parameter to mark_notification_read.php itself, and subsequently the redirect drops the rest of the parameters.

      This previously worked before these changes were deployed.

      I think all that needs changing is to encodeURIComponent() the redirection link to preserve its parameters when building the link to mark_notification_read.php but I haven't tested this yet.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                7 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/Nov/18