MDL-83143 core_course: Add course name as default for empty room name

This commit is contained in:
Safat 2024-09-26 16:01:53 +10:00
parent a6d857d9e5
commit e0cce75501

View File

@ -4801,6 +4801,12 @@ function course_get_communication_instance_data(int $courseid): array {
*/
function course_update_communication_instance_data(stdClass $data): void {
$data->id = $data->instanceid; // For correct use in update_course.
// If the room name is set to empty, then set it course name.
$provider = $data->selectedcommunication ?? null;
$roomnameidentifier = $provider . 'roomname';
if ($provider && empty($data->$roomnameidentifier)) {
$data->$roomnameidentifier = $data->fullname ?? get_course($data->id)->fullname;
}
core_communication\helper::update_course_communication_instance(
course: $data,
changesincoursecat: false,