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

Return iconurl for notifications returned by core_message_get_messages

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.11.3
    • Fix Version/s: 4.0
    • Component/s: Web Services
    • Labels:
    • Affected Branches:
      MOODLE_311_STABLE
    • Fixed Branches:
      MOODLE_400_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-72585-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. As the student, submit the assignment.
      10. Run the cron to send the assignment notifications.
      11. 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&type=notifications&read=0&newestfirst=1&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=core_message_get_messages&wstoken=WSTOKEN' --compressed

      12. Check that it returns a notification about the assignment.
      13. Check that the notification contains an iconurl.
      14. Check that the URL in iconurl is the assignment icon (you can open the URL in a browser to check it).
      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. As the student , submit the assignment. Run the cron to send the assignment notifications. 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&type=notifications&read=0&newestfirst=1&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=core_message_get_messages&wstoken=WSTOKEN' --compressed Check  that it returns a notification about the assignment. Check  that the notification contains an iconurl. Check that the URL in iconurl is the assignment icon (you can open the URL in a browser to check it).

      Description

      The WS message_popup_get_popup_notifications returns an iconurl, but that WS only returns "Web" (popup) notifications. This behaviour is weird in the app, so we'll use core_message_get_messages again. It would be nice if this WS could also return the iconurl to display it in the notification.

        Attachments

          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:
            5 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 - 2 hours, 5 minutes
                2h 5m