From 3bdfef910708eaba19daaf7d1d992cd4575af3b4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 1 Sep 2015 10:46:08 +0200 Subject: [PATCH] Add the request type to the action --- lib/private/notification/action.php | 10 +++++++++- lib/public/notification/iaction.php | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/private/notification/action.php b/lib/private/notification/action.php index 09e37a70d5..2f7c1a5b5f 100644 --- a/lib/private/notification/action.php +++ b/lib/private/notification/action.php @@ -34,6 +34,9 @@ class Action implements IAction { /** @var string */ protected $link; + /** @var string */ + protected $requestType; + /** @var string */ protected $icon; @@ -44,6 +47,7 @@ class Action implements IAction { $this->label = ''; $this->labelParsed = ''; $this->link = ''; + $this->requestType = ''; $this->icon = ''; } @@ -93,14 +97,18 @@ class Action implements IAction { /** * @param string $link + * @param string $requestType * @return $this * @throws \InvalidArgumentException if the link is invalid * @since 8.2.0 */ - public function setLink($link) { + public function setLink($link, $requestType) { if (!is_string($link) || $link === '' || isset($link[256])) { throw new \InvalidArgumentException('The given link is invalid'); } + if (!in_array($requestType, ['GET', 'POST', 'PUT', 'DELETE'])) { + throw new \InvalidArgumentException('The given request type is invalid'); + } $this->link = $link; return $this; } diff --git a/lib/public/notification/iaction.php b/lib/public/notification/iaction.php index 334f6cc44a..db60f6cedb 100644 --- a/lib/public/notification/iaction.php +++ b/lib/public/notification/iaction.php @@ -62,11 +62,12 @@ interface IAction { /** * @param string $link + * @param string $requestType * @return $this * @throws \InvalidArgumentException if the link is invalid * @since 8.2.0 */ - public function setLink($link); + public function setLink($link, $requestType); /** * @return string