added capability to reopen GitLab issues
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
namespace Kanboard\Action;
|
namespace Kanboard\Action;
|
||||||
|
|
||||||
use Kanboard\Integration\GithubWebhook;
|
use Kanboard\Integration\GithubWebhook;
|
||||||
|
use Kanboard\Integration\GitlabWebhook;
|
||||||
use Kanboard\Integration\BitbucketWebhook;
|
use Kanboard\Integration\BitbucketWebhook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,6 +24,7 @@ class TaskOpen extends Base
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
GithubWebhook::EVENT_ISSUE_REOPENED,
|
GithubWebhook::EVENT_ISSUE_REOPENED,
|
||||||
|
GitlabWebhook::EVENT_ISSUE_REOPENED,
|
||||||
BitbucketWebhook::EVENT_ISSUE_REOPENED,
|
BitbucketWebhook::EVENT_ISSUE_REOPENED,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class GitlabWebhook extends \Kanboard\Core\Base
|
|||||||
*/
|
*/
|
||||||
const EVENT_ISSUE_OPENED = 'gitlab.webhook.issue.opened';
|
const EVENT_ISSUE_OPENED = 'gitlab.webhook.issue.opened';
|
||||||
const EVENT_ISSUE_CLOSED = 'gitlab.webhook.issue.closed';
|
const EVENT_ISSUE_CLOSED = 'gitlab.webhook.issue.closed';
|
||||||
|
const EVENT_ISSUE_REOPENED = 'gitlab.webhook.issue.reopened';
|
||||||
const EVENT_COMMIT = 'gitlab.webhook.commit';
|
const EVENT_COMMIT = 'gitlab.webhook.commit';
|
||||||
const EVENT_ISSUE_COMMENT = 'gitlab.webhook.issue.commented';
|
const EVENT_ISSUE_COMMENT = 'gitlab.webhook.issue.commented';
|
||||||
|
|
||||||
@@ -164,6 +165,8 @@ class GitlabWebhook extends \Kanboard\Core\Base
|
|||||||
return $this->handleIssueOpened($payload['object_attributes']);
|
return $this->handleIssueOpened($payload['object_attributes']);
|
||||||
case 'close':
|
case 'close':
|
||||||
return $this->handleIssueClosed($payload['object_attributes']);
|
return $this->handleIssueClosed($payload['object_attributes']);
|
||||||
|
case 'reopen':
|
||||||
|
return $this->handleIssueReopened($payload['object_attributes']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -193,6 +196,36 @@ class GitlabWebhook extends \Kanboard\Core\Base
|
|||||||
return true;
|
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
|
* Handle issue closing
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ class Action extends Base
|
|||||||
GithubWebhook::EVENT_ISSUE_COMMENT => t('Github issue comment created'),
|
GithubWebhook::EVENT_ISSUE_COMMENT => t('Github issue comment created'),
|
||||||
GitlabWebhook::EVENT_COMMIT => t('Gitlab commit received'),
|
GitlabWebhook::EVENT_COMMIT => t('Gitlab commit received'),
|
||||||
GitlabWebhook::EVENT_ISSUE_OPENED => t('Gitlab issue opened'),
|
GitlabWebhook::EVENT_ISSUE_OPENED => t('Gitlab issue opened'),
|
||||||
|
GitlabWebhook::EVENT_ISSUE_REOPENED => t('Gitlab issue reopened'),
|
||||||
GitlabWebhook::EVENT_ISSUE_CLOSED => t('Gitlab issue closed'),
|
GitlabWebhook::EVENT_ISSUE_CLOSED => t('Gitlab issue closed'),
|
||||||
GitlabWebhook::EVENT_ISSUE_COMMENT => t('Gitlab issue comment created'),
|
GitlabWebhook::EVENT_ISSUE_COMMENT => t('Gitlab issue comment created'),
|
||||||
BitbucketWebhook::EVENT_COMMIT => t('Bitbucket commit received'),
|
BitbucketWebhook::EVENT_COMMIT => t('Bitbucket commit received'),
|
||||||
|
|||||||
Reference in New Issue
Block a user