MDL-65093 core_message: deprecate can_post_message()

This commit is contained in:
Mark Nelson 2019-07-25 14:22:20 +08:00
parent f622ee97e3
commit 06d046c1ff
7 changed files with 237 additions and 16 deletions

View file

@ -189,7 +189,7 @@ class core_message_external extends external_api {
// TODO MDL-31118 performance improvement - edit the function so we can pass an array instead userid
// Check if the recipient can be messaged by the sender.
if ($success && !\core_message\api::can_post_message($tousers[$message['touserid']], $USER)) {
if ($success && !\core_message\api::can_send_message($tousers[$message['touserid']]->id, $USER->id)) {
$success = false;
$errormessage = get_string('usercantbemessaged', 'message', fullname(\core_user::get_user($message['touserid'])));
}