From 61acd80ec3f5576988ba028f2de48940f5b6b696 Mon Sep 17 00:00:00 2001 From: Matthew Cillo Date: Thu, 3 Dec 2015 21:56:11 -0500 Subject: added capability to reopen GitLab issues --- app/Integration/GitlabWebhook.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'app/Integration/GitlabWebhook.php') diff --git a/app/Integration/GitlabWebhook.php b/app/Integration/GitlabWebhook.php index b3f9b0b5..17b6da70 100644 --- a/app/Integration/GitlabWebhook.php +++ b/app/Integration/GitlabWebhook.php @@ -19,6 +19,7 @@ class GitlabWebhook extends \Kanboard\Core\Base */ const EVENT_ISSUE_OPENED = 'gitlab.webhook.issue.opened'; const EVENT_ISSUE_CLOSED = 'gitlab.webhook.issue.closed'; + const EVENT_ISSUE_REOPENED = 'gitlab.webhook.issue.reopened'; const EVENT_COMMIT = 'gitlab.webhook.commit'; const EVENT_ISSUE_COMMENT = 'gitlab.webhook.issue.commented'; @@ -164,6 +165,8 @@ class GitlabWebhook extends \Kanboard\Core\Base return $this->handleIssueOpened($payload['object_attributes']); case 'close': return $this->handleIssueClosed($payload['object_attributes']); + case 'reopen': + return $this->handleIssueReopened($payload['object_attributes']); } return false; @@ -193,6 +196,36 @@ class GitlabWebhook extends \Kanboard\Core\Base return true; } + /** + * Handle issue reopening + * + * @access public + * @param array $issue Issue data + * @return boolean + */ + public function handleIssueReopened(array $issue) + { + $task = $this->taskFinder->getByReference($this->project_id, $issue['id']); + + if (! empty($task)) { + $event = array( + 'project_id' => $this->project_id, + 'task_id' => $task['id'], + 'reference' => $issue['id'], + ); + + $this->container['dispatcher']->dispatch( + self::EVENT_ISSUE_REOPENED, + new GenericEvent($event) + ); + + return true; + } + + return false; + } + + /** * Handle issue closing * -- cgit v1.2.3