XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.5
    • Fix Version/s: 2.9
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide

      Note: Version number is bumped because a new web service is added into the Mobile app service.

      1. Enable messaging in the site
      2. Create a couple of users accounts, user1 and user2
      3. Log in as user2, send a message from user2 to user1
      4. Retrieve the id value of that message from the database (table message)
      5. Enable "Mobile services": Plugins ► Web Services ►Mobile
      6. Create a Token for the Mobile app service (for user1):
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the messageid value with the message id .
        • You also need to replace the wstoken and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'messageid=1&timeread=1422449096&wsfunction=core_message_mark_message_read&wstoken=ffbe3a3002f235bf9d01fd9369e10b66'

      8. Confirm that:
        • The command returns a message id, this message is the id of the message in the message_read table. The original mesage in the message table was deleted.
        • If you use an incorrect message id, you got an error (record not found)
        • If you use am existing message id (but a message that was send to a different user) you will see an invalid parameter error (you don't have permissions to see the message)
      Show
      Note: Version number is bumped because a new web service is added into the Mobile app service. Enable messaging in the site Create a couple of users accounts, user1 and user2 Log in as user2, send a message from user2 to user1 Retrieve the id value of that message from the database (table message) Enable "Mobile services": Plugins ► Web Services ►Mobile Create a Token for the Mobile app service (for user1): Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client: You need to replace the messageid value with the message id . You also need to replace the wstoken and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'messageid=1&timeread=1422449096&wsfunction=core_message_mark_message_read&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' Confirm that: The command returns a message id, this message is the id of the message in the message_read table. The original mesage in the message table was deleted. If you use an incorrect message id, you got an error (record not found) If you use am existing message id (but a message that was send to a different user) you will see an invalid parameter error (you don't have permissions to see the message)
    • Affected Branches:
      MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-49501-master

      Description

      Note that this function is already in the core, and it triggers the message read event

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/May/15