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

Invalid field type for chatmethod in mod_chat_get_chats_by_courses WS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.1
    • Fix Version/s: 3.2.6, 3.3.3
    • Component/s: Chat
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a chat activity in a course
      2. Configure the global settings of the chat activity to use as chat method the "Normal method"
      3. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      4. Create a Token one student in the course where the chat activity is.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the wstoken, courseid and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=courseid&wsfunction=mod_chat_get_chats_by_courses&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' --compressed | python -m "json.tool"

      6. Confirm that
      7. The field chatmethod is correctly set to header_js
      Show
      Create a chat activity in a course Configure the global settings of the chat activity to use as chat method the "Normal method" Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token one student in the course where the chat activity is. 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 wstoken, courseid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=courseid&wsfunction=mod_chat_get_chats_by_courses&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' --compressed | python -m "json.tool" Confirm that The field chatmethod is correctly set to header_js
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-60018-master

      Description

      If the chat is configured to use the normal method, the WS returns an exception:

      {"exception":"invalid_response_exception","errorcode":"invalidresponse","message":"S'ha detectat un valor de resposta inv\u00e0lid","debuginfo":"chats => S'ha detectat un valor de resposta inv\u00e0lid: chatmethod => S'ha detectat un valor de resposta inv\u00e0lid: Invalid external api response: the value is \"header_js\", the server was expecting \"alpha\" type"}

      We need to change the param type from PARAM_ALPHA to a type supporting all the possible hardcoded methods.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Nov/17