MDL-79996 communication: valid instance checks during user deletion.

This commit is contained in:
Paul Holden 2023-11-03 12:53:34 +00:00
parent e4d1369475
commit 73143443b8
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164

View File

@ -4113,8 +4113,10 @@ function delete_user(stdClass $user) {
instancetype: 'coursecommunication',
instanceid: $course->id,
);
$communication->get_room_user_provider()->remove_members_from_room([$user->id]);
$communication->delete_instance_user_mapping([$user->id]);
if ($communication !== null) {
$communication->get_room_user_provider()->remove_members_from_room([$user->id]);
$communication->delete_instance_user_mapping([$user->id]);
}
}
}