Skip to content

Commit

Permalink
occ: Provide arguments for link and linktext
Browse files Browse the repository at this point in the history
  • Loading branch information
guruz committed Apr 9, 2018
1 parent 1b790f2 commit 7179c08
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/Command/Generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ protected function configure() {
->addOption('group', 'g', InputOption::VALUE_REQUIRED, 'Group id to whom the notification shall be sent to')
->addArgument('subject', InputArgument::REQUIRED, 'The notification subject - maximum 255 characters')
->addArgument('message', InputArgument::OPTIONAL, 'A longer message - maximum 4000 characters')
->addArgument('link', InputArgument::OPTIONAL, 'A link associated with the notification')
->addArgument('linktext', InputArgument::OPTIONAL, 'Description for the link')
;
}

Expand All @@ -70,6 +72,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
}
$subject = $input->getArgument('subject');
$message = $input->getArgument('message');
$link = $input->getArgument('link');
$linktext = $input->getArgument('linktext');

$users = [$user];
if ($group !== null) {
Expand All @@ -96,6 +100,13 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$notification->setMessage('admin-notification', [$message]);
}
$notification->setSubject('admin-notification', [$subject]);
if (!empty($link) && !empty($linktext)) {
// As per specification in https://github.com/owncloud/client/pull/6240
$notification->setLink($linktext . " " . $link);
} else 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 7179c08

Please sign in to comment.