From d7a8160c2b422dcf950093d9d17d90f1e80201de Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 21 Jun 2015 12:19:06 -0400 Subject: Update Bitbucket webhooks to handle issues/commit/comments --- app/Controller/Webhook.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'app/Controller/Webhook.php') diff --git a/app/Controller/Webhook.php b/app/Controller/Webhook.php index d04f83b3..1a4cfe9a 100644 --- a/app/Controller/Webhook.php +++ b/app/Controller/Webhook.php @@ -53,7 +53,7 @@ class Webhook extends Base $result = $this->githubWebhook->parsePayload( $this->request->getHeader('X-Github-Event'), - $this->request->getJson() ?: array() + $this->request->getJson() ); echo $result ? 'PARSED' : 'IGNORED'; @@ -69,7 +69,7 @@ class Webhook extends Base $this->checkWebhookToken(); $this->gitlabWebhook->setProjectId($this->request->getIntegerParam('project_id')); - $result = $this->gitlabWebhook->parsePayload($this->request->getJson() ?: array()); + $result = $this->gitlabWebhook->parsePayload($this->request->getJson()); echo $result ? 'PARSED' : 'IGNORED'; } @@ -84,7 +84,11 @@ class Webhook extends Base $this->checkWebhookToken(); $this->bitbucketWebhook->setProjectId($this->request->getIntegerParam('project_id')); - $result = $this->bitbucketWebhook->parsePayload(json_decode(@$_POST['payload'], true) ?: array()); + + $result = $this->bitbucketWebhook->parsePayload( + $this->request->getHeader('X-Event-Key'), + $this->request->getJson() + ); echo $result ? 'PARSED' : 'IGNORED'; } @@ -97,7 +101,7 @@ class Webhook extends Base public function postmark() { $this->checkWebhookToken(); - echo $this->postmark->receiveEmail($this->request->getJson() ?: array()) ? 'PARSED' : 'IGNORED'; + echo $this->postmark->receiveEmail($this->request->getJson()) ? 'PARSED' : 'IGNORED'; } /** -- cgit v1.2.3