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

New WebService to get the number of unread notifications (not popup)

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_311_STABLE
    • Fixed Branches:
      MOODLE_400_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-72586-master
    • Testing Instructions:
      Hide
      1. Create a course.
      2. Create 2 users. Make one of them a teacher in the course and the other a student.
      3. Add an assignment to the course.
      4. Enable 'Notify graders about submissions setting'.
      5. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      6. Create a Token in the mobile app service for the teacher in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. As the teacher, go to your profile:
        Click your avatar ► Profile
      8. Remember the id in the URL of the profile page. E.g. if the URL is https://MYSITE/user/profile.php?id=3, the id is 3.
      9. Open the console an execute this curl request, replacing WSTOKEN with the token you just created and the site url with yours. The USERID value has to be replaced with the id you annotated before.

        curl 'http://SITE_URL/webservice/rest/server.php?moodlewsrestformat=json' --data 'useridto=USERID&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=core_message_get_unread_notification_count&wstoken=WSTOKEN' --compressed

      1. Check that it returns the number "0".
      2. As the student, submit the assignment.
      3. Run the cron to send the assignment notifications.
      4. Execute the same curl request.  Check that now it returns the number "1".
      Show
      Create a course. Create 2 users. Make one of them a teacher in the course and the other a student. Add an assignment to the course. Enable 'Notify graders about submissions setting'. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the teacher in the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens As the teacher, go to your profile: Click your avatar ► Profile Remember the id in the URL of the profile page. E.g. if the URL is  https://MYSITE/user/profile.php?id=3,  the id is 3. Open the console an execute this curl request, replacing WSTOKEN with the token you just created and the site url with yours. The USERID value has to be replaced with the id you annotated before. curl 'http://SITE_URL/webservice/rest/server.php?moodlewsrestformat=json' --data 'useridto=USERID&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=core_message_get_unread_notification_count&wstoken=WSTOKEN' --compressed Check that it returns the number "0". As the student, submit the assignment. Run the cron to send the assignment notifications. Execute the same curl request.   Check that now it returns the number "1".

      Description

      The WS message_popup_get_unread_popup_notification_count returns the number of unread popup notifications, we need a similar WebService to get the number of ALL unread notifications (not just popup).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dpalou Dani Palou
              Reporter:
              dpalou Dani Palou
              Peer reviewer:
              Juan Leyva Juan Leyva
              Integrator:
              Andrew Lyons Andrew Lyons
              Tester:
              Angelia Dela Cruz Angelia Dela Cruz
              Participants:
              Component watchers:
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 5 hours, 31 minutes
                  5h 31m