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

HTML in activity titles break web notifications

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Go to Site administration > Appearance > HTML settings.
      2. Un-select "Remove HTML tags from all activity names". Save changes.
      3. Go to Site administration > Plugins > Message outputs > Manage message outputs.
      4. Ensure Web is enabled.
      5. Go to Site administration > Plugins > Message outputs > Default message outputs.
      6. Ensure that Assignment Notifications is enabled and permitted for Web.
      7. In a course, create a new assignment and include HTML in the assignment name, for example: Research Paper Draft <font color="#008000"><strong>(Due at the end of Module 5)</strong></font>
      8. Enrol a student in the course.
      9. Login as the student and navigate to the user's notification preferences.
      10. Ensure that Assignment notifications is turned on for Web.
      11. As the student, make a submission to the assignment.
      12. Observe that the number next to the bell notification icon increases by one.
      13. Click on the bell icon to open the notifications menu.
      14. Confirm you can see the notification with no WS error (and the HTML is also stripped).
      15. Click on it and confirm it takes you to the right place.
      Show
      Go to Site administration > Appearance > HTML settings. Un-select "Remove HTML tags from all activity names". Save changes. Go to Site administration > Plugins > Message outputs > Manage message outputs. Ensure Web is enabled. Go to Site administration > Plugins > Message outputs > Default message outputs. Ensure that Assignment Notifications is enabled and permitted for Web. In a course, create a new assignment and include HTML in the assignment name, for example: Research Paper Draft <font color="#008000"><strong>(Due at the end of Module 5)</strong></font> Enrol a student in the course. Login as the student and navigate to the user's notification preferences. Ensure that Assignment notifications is turned on for Web. As the student, make a submission to the assignment. Observe that the number next to the bell notification icon increases by one. Click on the bell icon to open the notifications menu. Confirm you can see the notification with no WS error (and the HTML is also stripped). Click on it and confirm it takes you to the right place.
    • Affected Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-61196_master

      Description

      DESCRIPTION
      When activities have HTML in their title and those titles are included in the subject of notifications, the HTML can break the notification interface preventing users from accessing their notifications.

      Invalid response value detected
      File: /lib/externallib.php
      Line: 424
      Stack trace:
      notifications => Invalid response value detected: subject => Invalid response value detected: Invalid external api response: the value is "You have submitted your assignment submission for Research Paper Draft <font color="#008000"><strong>(Due at the end of Module 5)</strong></font>", the server was expecting "text" type
      Error code: invalidresponse

      • line 424 of /lib/externallib.php: invalid_response_exception thrown
      • line 233 of /lib/externallib.php: call to external_api::clean_returnvalue()
      • line 59 of /lib/ajax/service.php: call to external_api::call_external_function()

      STEPS TO REPLICATE
      1. Go to Site administration > Appearance > HTML settings.
      2. Un-select "Remove HTML tags from all activity names". Save changes.
      3. Go to Site administration > Plugins > Message outputs > Manage message outputs.
      4. Ensure Web is enabled.
      5. Go to Site administration > Plugins > Message outputs > Default message outputs.
      6. Ensure that Assignment Notifications is enabled and permitted for Web.
      7. In a course, create a new assignment and include HTML in the assignment name, for example: Research Paper Draft <font color="#008000"><strong>(Due at the end of Module 5)</strong></font>
      8. Enroll a student in the course.
      9. Login as the student and navigate to the user's notification preferences.
      10. Ensure that Assignment notifications is turned on for Web.
      11. As the student, make a submission to the assignment.
      12. Observe that the number next to the bell notification icon increases by one.
      13. Click on the bell icon to open the notifications menu.

      OBSERVED BEHAVIOR:
      An "Invalid response error" is received and the notifications cannot be viewed.

      EXPECTED BEHAVIOR:
      The notification menu expands including a notification informing that a submission has been made to the assignment.

      REPLICATION LOCATIONS
      Replicated in Moodle 3.3.3.

      USER IMPACT
      Students are unable to access their notifications.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              markn Mark Nelson
              Reporter:
              brian.winstead Brian Winstead
              Peer reviewer:
              Carlos Escobedo
              Integrator:
              Andrew Nicols
              Tester:
              Gladys Basiana
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                19/Mar/18

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h