Send all Kanboard events to the webhook (breaking change)

This commit is contained in:
Frederic Guillot
2015-05-18 21:04:06 -04:00
parent db95e96f92
commit 6d5ffaa848
30 changed files with 501 additions and 154 deletions

View File

@@ -129,7 +129,9 @@ class Comment extends Base
->eq('id', $values['id'])
->update(array('comment' => $values['comment']));
$this->container['dispatcher']->dispatch(self::EVENT_UPDATE, new CommentEvent($values));
if ($result) {
$this->container['dispatcher']->dispatch(self::EVENT_UPDATE, new CommentEvent($values));
}
return $result;
}

View File

@@ -14,20 +14,23 @@ class Webhook extends Base
* Call the external URL
*
* @access public
* @param string $url URL to call
* @param array $task Task data
* @param array $values Event payload
*/
public function notify($url, array $task)
public function notify(array $values)
{
$url = $this->config->get('webhook_url');
$token = $this->config->get('webhook_token');
if (strpos($url, '?') !== false) {
$url .= '&token='.$token;
}
else {
$url .= '?token='.$token;
}
if (! empty($url)) {
return $this->httpClient->post($url, $task);
if (strpos($url, '?') !== false) {
$url .= '&token='.$token;
}
else {
$url .= '?token='.$token;
}
return $this->httpClient->post($url, $values);
}
}
}