diff options
Diffstat (limited to 'lib/Command/Room/Promote.php')
-rw-r--r-- | lib/Command/Room/Promote.php | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/lib/Command/Room/Promote.php b/lib/Command/Room/Promote.php index 44b378c74..613d8d0b7 100644 --- a/lib/Command/Room/Promote.php +++ b/lib/Command/Room/Promote.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\Output\OutputInterface; @@ -38,19 +37,6 @@ use Symfony\Component\Console\Output\OutputInterface; class Promote 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:promote') @@ -84,12 +70,24 @@ class Promote extends Base { try { $this->addRoomModerators($room, $users); - } catch (Exception $e) { + } catch (InvalidArgumentException $e) { $output->writeln(sprintf('<error>%s</error>', $e->getMessage())); return 1; } - $output->writeln('<info>Users successfully added to room.</info>'); + $output->writeln('<info>Participants successfully promoted to moderators.</info>'); return 0; } + + public function completeArgumentValues($argumentName, CompletionContext $context) { + switch ($argumentName) { + case 'token': + return $this->completeTokenValues($context); + + case 'participant': + return $this->completeParticipantValues($context); + } + + return parent::completeArgumentValues($argumentName, $context); + } } |