Skip to content

Commit

Permalink
Chatroom: Simplify creation code
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansenDatabay committed Aug 23, 2024
1 parent d4cd03f commit 63bd058
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
29 changes: 0 additions & 29 deletions components/ILIAS/Chatroom/classes/class.ilChatroomFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,35 +59,6 @@ public static function applyValues(ilPropertyFormGUI $form, array $values): void
);
}

/**
* Instantiates and returns ilPropertyFormGUI containing ilTextInputGUI
* and ilTextAreaInputGUI
* @deprecated replaced by default creation screens
*/
public function getCreationForm(): ilPropertyFormGUI
{
$form = new ilPropertyFormGUI();
$title = new ilTextInputGUI($this->lng->txt('title'), 'title');
$title->setRequired(true);
$form->addItem($title);

$description = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
$form->addItem($description);

return $this->addDefaultBehaviour($form);
}

/**
* Adds 'create-save' and 'cancel' button to given $form and returns it.
*/
private function addDefaultBehaviour(ilPropertyFormGUI $form): ilPropertyFormGUI
{
$form->addCommandButton('create-save', $this->lng->txt('create'));
$form->addCommandButton('cancel', $this->lng->txt('cancel'));

return $form;
}

private function mergeValuesTrafo(): \ILIAS\Refinery\Transformation
{
return $this->refinery->custom()->transformation(static fn(array $values): array => array_merge(...$values));
Expand Down
4 changes: 3 additions & 1 deletion components/ILIAS/Chatroom/classes/class.ilObjChatroomGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ protected function afterSave(ilObject $new_object): void

$connector = $this->getConnector();
$response = $connector->sendCreatePrivateRoom(
$room->getRoomId(), $new_object->getOwner(), $new_object->getTitle()
$room->getRoomId(),
$new_object->getOwner(),
$new_object->getTitle()
);

$this->tpl->setOnScreenMessage('success', $this->lng->txt('object_added'), true);
Expand Down

0 comments on commit 63bd058

Please sign in to comment.