MDL-57967 core_message: do not process conversations from deleted users
This commit is contained in:
@@ -417,7 +417,8 @@ class api {
|
||||
$userfields = \user_picture::fields('', array('lastaccess'));
|
||||
$userssql = "SELECT $userfields
|
||||
FROM {user}
|
||||
WHERE id $useridsql";
|
||||
WHERE id $useridsql
|
||||
AND deleted = 0";
|
||||
$otherusers = $DB->get_records_sql($userssql, $usersparams);
|
||||
|
||||
// Similar to the above use case, we need to pull the contact information and again this has
|
||||
@@ -478,6 +479,11 @@ class api {
|
||||
$conversation->$prop = ($otheruser) ? $otheruser->$prop : null;
|
||||
}
|
||||
|
||||
// Do not process a conversation with a deleted user.
|
||||
if (empty($conversation->id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the contact's information, if we have one.
|
||||
$conversation->blocked = ($contact) ? $contact->blocked : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user