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

Mark-notification-read JS breaks some URLs

    XMLWordPrintable

    Details

    • Testing Instructions:
      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.    
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Pull 3.5 Branch:
    • Pull Master Branch:

      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

              Assignee:
              peter.spicer Peter Spicer
              Reporter:
              peter.spicer Peter Spicer
              Peer reviewer:
              Dan Marsden
              Integrator:
              Damyon Wiese
              Tester:
              Damyon Wiese
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              7 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

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