Skip to content

Commit

Permalink
Merge pull request #172 from owncloud/link_argument_occ
Browse files Browse the repository at this point in the history
occ: Provide arguments for link and linktext
  • Loading branch information
DeepDiver1975 authored Apr 12, 2018
2 parents 740f812 + 548beaf commit 80112f7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Command/Generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ protected function configure() {
->setDescription('Generates a notification')
->addOption('user', 'u', InputOption::VALUE_REQUIRED, 'User id to whom the notification shall be sent to')
->addOption('group', 'g', InputOption::VALUE_REQUIRED, 'Group id to whom the notification shall be sent to')
->addOption('link', 'l', InputOption::VALUE_REQUIRED, 'A link associated with the notification', null)
->addArgument('subject', InputArgument::REQUIRED, 'The notification subject - maximum 255 characters')
->addArgument('message', InputArgument::OPTIONAL, 'A longer message - maximum 4000 characters')
;
Expand All @@ -70,6 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
}
$subject = $input->getArgument('subject');
$message = $input->getArgument('message');
$link = $input->getOption('link');

$users = [$user];
if ($group !== null) {
Expand All @@ -96,6 +98,10 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$notification->setMessage('admin-notification', [$message]);
}
$notification->setSubject('admin-notification', [$subject]);
if (!empty($link)) {
$notification->setLink($link);
}

$notification->setObject('admin-notification', $time);
if (method_exists($notification, 'setIcon')) {
$notification->setIcon($this->urlGenerator->imagePath('notifications', 'icon.png'));
Expand Down

0 comments on commit 80112f7

Please sign in to comment.