1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-02 23:12:32 +02:00

Merge branch 'MDL-63303_master-deleteduserfix' of https://github.com/markn86/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2018-11-15 11:20:36 +01:00
commit 9ca803a86d
2 changed files with 9 additions and 2 deletions
message

@ -531,8 +531,12 @@ class helper {
$data->profileimageurlsmall = $userpicture->get_url($PAGE)->out(false);
// Set online status indicators.
$data->isonline = self::show_online_status($member) ? self::is_online($member->lastaccess) : null;
$data->showonlinestatus = is_null($data->isonline) ? false : true;
$data->isonline = false;
$data->showonlinestatus = false;
if (!$member->deleted) {
$data->isonline = self::show_online_status($member) ? self::is_online($member->lastaccess) : null;
$data->showonlinestatus = is_null($data->isonline) ? false : true;
}
// Set contact and blocked status indicators.
$data->iscontact = ($member->contactid) ? true : false;

@ -1370,6 +1370,9 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
// We should have 5, as $ic1 drops off the list.
// Group conversations remain albeit with less members.
delete_user($user2);
// This is to confirm an exception is not thrown when a user AND the user context is deleted.
// We no longer delete the user context, but historically we did.
context_helper::delete_instance(CONTEXT_USER, $user2->id);
$conversations = \core_message\api::get_conversations($user1->id);
$this->assertCount(5, $conversations);
$this->assertEquals($gc3->id, $conversations[0]->id);