Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Command/Room/Add.php')
-rw-r--r--lib/Command/Room/Add.php48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/Command/Room/Add.php b/lib/Command/Room/Add.php
index c48755aa4..d5d0b7338 100644
--- a/lib/Command/Room/Add.php
+++ b/lib/Command/Room/Add.php
@@ -25,12 +25,11 @@ declare(strict_types=1);
namespace OCA\Talk\Command\Room;
-use Exception;
+use InvalidArgumentException;
use OC\Core\Command\Base;
use OCA\Talk\Exceptions\RoomNotFoundException;
-use OCA\Talk\Manager;
use OCA\Talk\Room;
-use OCP\IUserManager;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -39,19 +38,6 @@ use Symfony\Component\Console\Output\OutputInterface;
class Add extends Base {
use TRoomCommand;
- /** @var IUserManager */
- public $userManager;
-
- /** @var Manager */
- public $manager;
-
- public function __construct(IUserManager $userManager, Manager $manager) {
- parent::__construct();
-
- $this->userManager = $userManager;
- $this->manager = $manager;
- }
-
protected function configure(): void {
$this
->setName('talk:room:add')
@@ -70,11 +56,6 @@ class Add extends Base {
null,
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
'Invites all members of the given groups to the room'
- )->addOption(
- 'circle',
- null,
- InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
- 'Invites all members of the given circles to the room'
);
}
@@ -82,7 +63,6 @@ class Add extends Base {
$token = $input->getArgument('token');
$users = $input->getOption('user');
$groups = $input->getOption('group');
- $circles = $input->getOption('circle');
try {
$room = $this->manager->getRoomByToken($token);
@@ -99,8 +79,7 @@ class Add extends Base {
try {
$this->addRoomParticipants($room, $users);
$this->addRoomParticipantsByGroup($room, $groups);
- $this->addRoomParticipantsByCircle($room, $circles);
- } catch (Exception $e) {
+ } catch (InvalidArgumentException $e) {
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
return 1;
}
@@ -108,4 +87,25 @@ class Add extends Base {
$output->writeln('<info>Users successfully added to room.</info>');
return 0;
}
+
+ public function completeOptionValues($optionName, CompletionContext $context) {
+ switch ($optionName) {
+ case 'user':
+ return $this->completeUserValues($context);
+
+ case 'group':
+ return $this->completeGroupValues($context);
+ }
+
+ return parent::completeOptionValues($optionName, $context);
+ }
+
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ switch ($argumentName) {
+ case 'token':
+ return $this->completeTokenValues($context);
+ }
+
+ return parent::completeArgumentValues($argumentName, $context);
+ }
}