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

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.6
    • 3.6
    • Messages
    • MOODLE_36_STABLE
    • MOODLE_36_STABLE
    • MDL-64060-master
    • 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

    Description

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

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

      Attachments

        Activity

          People

            jleyva Juan Leyva
            dpalou Dani Palou
            Carlos Escobedo Carlos Escobedo
            David Monllaó David Monllaó
            Janelle Barcega Janelle Barcega
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              3/Dec/18

              Time Tracking

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