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

core_message_get_conversation_between_users and core_message_get_conversation return a wrong exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6
    • Fix Version/s: 3.6
    • Component/s: Messages
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Ensure that "Messaging" is enabled in Site administration ► Advanced features
      3. Create a Token in the mobile app service for any user in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. You have to replace also the userid with the user id you created the token for:

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_message_get_conversation&userid=19&includecontactrequests=1&conversationid=100&includeprivacyinfo=1&wstoken=3af67232a7596ceb658df4db329e5ad6'

      5. Confirm that:
        • You see a moodle exception with error code set to: conversationdoesntexist
      6. Execute now the following CURL request (doing the same replacements than for the previous one)

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_message_get_conversation_between_users&userid=19&otheruserid=2&includecontactrequests=1&includeprivacyinfo=1&wstoken=3af67232a7596ceb658df4db329e5ad6'

      7. Confirm that:
        • You see a moodle exception with error code set to: conversationdoesntexist
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Ensure that "Messaging" is enabled in Site administration ► Advanced features Create a Token in the mobile app service for any user in the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. You have to replace also the userid with the user id you created the token for: curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_message_get_conversation&userid=19&includecontactrequests=1&conversationid=100&includeprivacyinfo=1&wstoken=3af67232a7596ceb658df4db329e5ad6' Confirm that: You see a moodle exception with error code set to: conversationdoesntexist Execute now the following CURL request (doing the same replacements than for the previous one) curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_message_get_conversation_between_users&userid=19&otheruserid=2&includecontactrequests=1&includeprivacyinfo=1&wstoken=3af67232a7596ceb658df4db329e5ad6' Confirm that: You see a moodle exception with error code set to: conversationdoesntexist
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-64060-master

      Description

      Both WebServices return a hardcoded exception instead of using a translated string:

      throw new \moodle_exception('Conversation does not exist');

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Dec/18

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 10 minutes
                10m