MDL-81932 core_communication: Fix communication provider change issue
This commit is contained in:
@@ -265,13 +265,13 @@ class api {
|
||||
$mform->insertElementBefore(
|
||||
$mform->createElement(
|
||||
'text',
|
||||
'communicationroomname',
|
||||
$provider . 'roomname',
|
||||
get_string('communicationroomname', 'communication'),
|
||||
'maxlength="100" size="20"'
|
||||
),
|
||||
'addcommunicationoptionshere'
|
||||
);
|
||||
$mform->setType('communicationroomname', PARAM_TEXT);
|
||||
$mform->setType($provider . 'roomname', PARAM_TEXT);
|
||||
|
||||
$mform->insertElementBefore(
|
||||
$mform->createElement(
|
||||
@@ -376,6 +376,9 @@ class api {
|
||||
* @return string
|
||||
*/
|
||||
public function get_room_name(): string {
|
||||
if (!$this->communication) {
|
||||
return '';
|
||||
}
|
||||
return $this->communication->get_room_name();
|
||||
}
|
||||
|
||||
@@ -387,7 +390,8 @@ class api {
|
||||
public function set_data(\stdClass $instance): void {
|
||||
if (!empty($instance->id) && $this->communication) {
|
||||
$instance->selectedcommunication = $this->communication->get_provider();
|
||||
$instance->communicationroomname = $this->communication->get_room_name();
|
||||
$roomnameidentifier = $this->get_provider() . 'roomname';
|
||||
$instance->$roomnameidentifier = $this->communication->get_room_name();
|
||||
|
||||
$this->communication->get_form_provider()->set_form_data($instance);
|
||||
}
|
||||
@@ -474,8 +478,6 @@ class api {
|
||||
// Now deactivate the previous provider.
|
||||
$this->update_room(
|
||||
active: processor::PROVIDER_INACTIVE,
|
||||
communicationroomname: $communicationroomname,
|
||||
avatar: $instanceimage,
|
||||
instance: $instance,
|
||||
queue: $queue,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user