-
Bug
-
Resolution: Fixed
-
Minor
-
3.7.4, 3.8.1, 3.9, 3.10, 4.0
-
MOODLE_310_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
-
MOODLE_38_STABLE, MOODLE_39_STABLE
-
MDL-68070-master_messaging_fix -
When "Personal messages between users" is disabled, attempting to send a message to a user results in the error messages:
"timestamps => Invalid parameter value detected (timestamp => Invalid parameter value detected (Invalid external api parameter: the value is "NaN", the server was expecting "int" type): Invalid external api parameter: the value is "NaN", the server was expecting "int" type): timestamp => Invalid parameter value detected (Invalid external api parameter: the value is "NaN", the server was expecting "int" type): Invalid external api parameter: the value is "NaN", the server was expecting "int" type
Error code: invalidparameter"
AND
Type Error
message.userfrom is undefined
Steps to replicate:
As Admin, open the message settings
http://tbc.test/admin/message.php
Uncheck "Personal messages between users" in the "enabled" column.
Save changes
Open a user's profile page and click the message icon next to their name
Try sending a message to the user
Expected:
Message sent
Actual:
See error messages already described.
Suggested solution:
In messagelib.php there is a function called "message_send".
This function returns false if "personal messages between users" is set to disabled.
This causes problems for the core_message_send_instant_messages which continues to send the response fields you would normally expect except that the id is null and the timecreated fields isn't a number.
The webservice should throw an error to say that personal messages are disabled between users.
A second improvement would be to modify the user interface so that it isn't possible to send messages when the "personal messages between uesrs" setting is disabled.