diff options
author | Joas Schilling <coding@schilljs.com> | 2016-09-12 11:26:46 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-09-12 11:26:46 +0300 |
commit | 83cbc6a4000875e66e02e4b1076e291c84447c48 (patch) | |
tree | b7bcb24fa2e3758114d2f8b168e971b2b7617164 /lib | |
parent | 8a2eafa9b445a5d011702479deeda63cacf16730 (diff) |
Fix the notification URLs when they where created too early
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Notifier.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Notifier.php b/lib/Notifier.php index 995551f..5341866 100644 --- a/lib/Notifier.php +++ b/lib/Notifier.php @@ -21,6 +21,7 @@ namespace OCA\Survey_Client; +use OCP\IURLGenerator; use OCP\L10N\IFactory; use OCP\Notification\INotification; use OCP\Notification\INotifier; @@ -30,13 +31,18 @@ class Notifier implements INotifier { /** @var IFactory */ protected $l10nFactory; + /** @var IURLGenerator */ + protected $url; + /** * Notifier constructor. * * @param IFactory $l10nFactory + * @param IURLGenerator $url */ - public function __construct(IFactory $l10nFactory) { + public function __construct(IFactory $l10nFactory, IURLGenerator $url) { $this->l10nFactory = $l10nFactory; + $this->url = $url; } /** @@ -59,9 +65,11 @@ class Notifier implements INotifier { foreach ($notification->getActions() as $action) { if ($action->getLabel() === 'disable') { - $action->setParsedLabel((string) $l->t('Not now')); + $action->setParsedLabel((string) $l->t('Not now')) + ->setLink($this->url->getAbsoluteURL('ocs/v2.php/apps/survey_client/api/v1/monthly'), 'DELETE'); } else if ($action->getLabel() === 'enable') { - $action->setParsedLabel((string) $l->t('Send usage')); + $action->setParsedLabel((string) $l->t('Send usage')) + ->setLink($this->url->getAbsoluteURL('ocs/v2.php/apps/survey_client/api/v1/monthly'), 'POST'); } $notification->addParsedAction($action); } |