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

Multiple fixes when redirecting to a URL when clicking on a notification

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Test 1 (for master and 3.5)
      1. Run the attached test.php script in the console.
        This will create four new notifications for the admin user.
      2. Login as admin
      3. Click on the "Bell" icon in the top bar near the user menu
        1. Confirm there are four unread notifications
      4. Click on the notification marked "Subject"
        1. Confirm you are redirected to the notification page
      5. Click on the notification marked "https://www.google.com"
        1. *Confirm you are redirected to https://www.google.com*
      6. Click on the notification marked "/message/index.php"
        1. Confirm you are redirected to the message index
      7. Click on the notification marked ";"
        1. Confirm you are redirected to the notification page
      Test 2 (for 3.4)
      1. Run the attached test_34.php script in the console.
        This will create four new notifications for the admin user.
      2. Login as admin
      3. Click on the "Bell" icon in the top bar near the user menu
        1. Confirm there are four unread notifications
      4. Click on the notification marked "Subject"
        1. Confirm you are redirected to the notification page
      5. Click on the notification marked "https://www.google.com"
        1. *Confirm you are redirected to https://www.google.com*
      6. Click on the notification marked "/message/index.php"
        1. Confirm you are redirected to the message index
      7. Click on the notification marked ";"
        1. Confirm you are redirected to the notification page
      Show
      Test 1 (for master and 3.5) Run the attached test.php script in the console. This will create four new notifications for the admin user. Login as admin Click on the "Bell" icon in the top bar near the user menu Confirm there are four unread notifications Click on the notification marked "Subject" Confirm you are redirected to the notification page Click on the notification marked "https://www.google.com" *Confirm you are redirected to https://www.google.com* Click on the notification marked "/message/index.php" Confirm you are redirected to the message index Click on the notification marked ";" Confirm you are redirected to the notification page Test 2 (for 3.4) Run the attached test_34.php script in the console. This will create four new notifications for the admin user. Login as admin Click on the "Bell" icon in the top bar near the user menu Confirm there are four unread notifications Click on the notification marked "Subject" Confirm you are redirected to the notification page Click on the notification marked "https://www.google.com" *Confirm you are redirected to https://www.google.com* Click on the notification marked "/message/index.php" Confirm you are redirected to the message index Click on the notification marked ";" Confirm you are redirected to the notification page
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Pull from Repository:
    • Pull 3.4 Branch:
    • Pull 3.5 Branch:
    • Pull Master Branch:
      MDL-62889_master

      Description

      While testing one of our community sites upgraded to 3.5.1:

      Thanks Mark Nelson who promptly and correctly debugged this as a likely regression of MDL-56498. In that issue, we introduce

      +            // Link to mark read page before loading the actual link.
      +            notification.contexturl = URL.relativeUrl('message/output/popup/mark_notification_read.php', {
      +                redirecturl: notification.contexturl,
      +                notificationid: notification.id,
      +            });
      

      to message/output/popup/amd/src/notification_popover_controller.js

      But apparently, the notification.contexturl can be NULL. We should not include redirecturl as the link parameter in that case.

        Attachments

        1. 3.5Notificationerror.png
          3.5Notificationerror.png
          43 kB
        2. MDL-62889-test-results.png
          MDL-62889-test-results.png
          226 kB
        3. test_34.php
          2 kB
        4. test.php
          2 kB

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Sep/18