Merge branch 'MDL-81595-main' of https://github.com/safatshahin/moodle
This commit is contained in:
@@ -427,6 +427,7 @@ class api {
|
||||
* @param string $communicationroomname The communication room name
|
||||
* @param array $users The user ids to add to the room
|
||||
* @param null|\stored_file $instanceimage The stored file for the avatar
|
||||
* @param bool $queue Queue the task for the provider room or not
|
||||
*/
|
||||
public function configure_room_and_membership_by_provider(
|
||||
string $provider,
|
||||
@@ -434,6 +435,7 @@ class api {
|
||||
string $communicationroomname,
|
||||
array $users,
|
||||
?\stored_file $instanceimage = null,
|
||||
bool $queue = true,
|
||||
): void {
|
||||
// If the current provider is inactive and the new provider is also none, then nothing to do.
|
||||
if (
|
||||
@@ -456,6 +458,7 @@ class api {
|
||||
communicationroomname: $communicationroomname,
|
||||
avatar: $instanceimage,
|
||||
instance: $instance,
|
||||
queue: $queue,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -474,6 +477,7 @@ class api {
|
||||
communicationroomname: $communicationroomname,
|
||||
avatar: $instanceimage,
|
||||
instance: $instance,
|
||||
queue: $queue,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -492,8 +496,9 @@ class api {
|
||||
communicationroomname: $communicationroomname,
|
||||
avatar: $instanceimage,
|
||||
instance: $instance,
|
||||
queue: $queue,
|
||||
);
|
||||
$queue = false;
|
||||
$queueusertask = false;
|
||||
} else {
|
||||
// Otherwise update the room.
|
||||
$this->update_room(
|
||||
@@ -501,14 +506,15 @@ class api {
|
||||
communicationroomname: $communicationroomname,
|
||||
avatar: $instanceimage,
|
||||
instance: $instance,
|
||||
queue: $queue,
|
||||
);
|
||||
$queue = true;
|
||||
$queueusertask = true;
|
||||
}
|
||||
|
||||
// Now add the members.
|
||||
$this->add_members_to_room(
|
||||
userids: $users,
|
||||
queue: $queue,
|
||||
queue: $queueusertask,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -480,30 +480,21 @@ class helper {
|
||||
$communication = self::load_by_course(
|
||||
courseid: $course->id,
|
||||
context: $coursecontext,
|
||||
provider: $provider === processor::PROVIDER_NONE ? null : $provider,
|
||||
);
|
||||
|
||||
if ($communication->get_processor() === null) {
|
||||
// If a course communication instance is not created, create one.
|
||||
$communication->create_and_configure_room(
|
||||
communicationroomname: $course->communicationroomname,
|
||||
avatar: $courseimage,
|
||||
instance: $course,
|
||||
queue: false,
|
||||
);
|
||||
} else {
|
||||
$communication->remove_all_members_from_room();
|
||||
// Now update the course communication instance with the latest changes.
|
||||
// We are not making room for this instance as it is a group mode enabled course.
|
||||
// If provider is none, then we will make the room inactive, otherwise always active in group mode.
|
||||
$communication->update_room(
|
||||
active: $provider === processor::PROVIDER_NONE ? processor::PROVIDER_INACTIVE : processor::PROVIDER_ACTIVE,
|
||||
communicationroomname: $course->communicationroomname,
|
||||
avatar: $courseimage,
|
||||
instance: $course,
|
||||
queue: false,
|
||||
);
|
||||
}
|
||||
// Now handle the course communication according to the provider.
|
||||
$communication->configure_room_and_membership_by_provider(
|
||||
provider: $provider,
|
||||
instance: $course,
|
||||
communicationroomname: $course->communicationroomname,
|
||||
users: $enrolledusers,
|
||||
instanceimage: $courseimage,
|
||||
queue: false,
|
||||
);
|
||||
|
||||
// As the course is in group mode, make sure no users are in the course room.
|
||||
$communication->reload();
|
||||
$communication->remove_all_members_from_room();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user