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

Mark-notification-read JS breaks some URLs

XMLWordPrintable

    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Hide

      Login as a teacher in a course with an assignment.

      Make sure the "Notify graders about submissions" setting for the assignment is turned on.

      Make sure "Online Text" is enabled for the submission types.

      Make sure under notification preferences for the teacher, the Web notifications are enabled for assignment for both "Online" and "Offline".

      Login as a student and submit to the assignment.

      Login as the teacher and click on the notification.

      Verify the page is reloaded to the same place but the notification is marked as read.

       

       

      Show
      Login as a teacher in a course with an assignment. Make sure the "Notify graders about submissions" setting for the assignment is turned on. Make sure "Online Text" is enabled for the submission types. Make sure under notification preferences for the teacher, the Web notifications are enabled for assignment for both "Online" and "Offline". Login as a student and submit to the assignment. Login as the teacher and click on the notification. Verify the page is reloaded to the same place but the notification is marked as read.    

      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.

            peter.spicer Peter Spicer
            peter.spicer Peter Spicer
            Dan Marsden Dan Marsden
            Damyon Wiese Damyon Wiese
            Damyon Wiese Damyon Wiese
            Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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