Skip to content
This repository has been archived by the owner on Apr 5, 2020. It is now read-only.

Commit

Permalink
Update to the latest version of KB
Browse files Browse the repository at this point in the history
  • Loading branch information
fguillot committed May 8, 2016
1 parent 0bbd18d commit 7e1ad3f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
23 changes: 12 additions & 11 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ class Plugin extends Base
{
public function initialize()
{
$this->on('app.bootstrap', function($container) {
Translator::load($container['config']->getCurrentLanguage(), __DIR__.'/Locale');

$container['eventManager']->register(WebhookHandler::EVENT_COMMIT, t('Gitlab commit received'));
$container['eventManager']->register(WebhookHandler::EVENT_ISSUE_OPENED, t('Gitlab issue opened'));
$container['eventManager']->register(WebhookHandler::EVENT_ISSUE_CLOSED, t('Gitlab issue closed'));
$container['eventManager']->register(WebhookHandler::EVENT_ISSUE_REOPENED, t('Gitlab issue reopened'));
$container['eventManager']->register(WebhookHandler::EVENT_ISSUE_COMMENT, t('Gitlab issue comment created'));
});

$this->actionManager->getAction('\Kanboard\Action\CommentCreation')->addEvent(WebhookHandler::EVENT_ISSUE_COMMENT);
$this->actionManager->getAction('\Kanboard\Action\CommentCreation')->addEvent(WebhookHandler::EVENT_COMMIT);
$this->actionManager->getAction('\Kanboard\Action\TaskClose')->addEvent(WebhookHandler::EVENT_COMMIT);
Expand All @@ -31,6 +21,17 @@ public function initialize()
$this->route->addRoute('/webhook/gitlab/:project_id/:token', 'webhook', 'handler', 'GitlabWebhook');
}

public function onStartup()
{
Translator::load($this->language->getCurrentLanguage(), __DIR__.'/Locale');

$this->eventManager->register(WebhookHandler::EVENT_COMMIT, t('Gitlab commit received'));
$this->eventManager->register(WebhookHandler::EVENT_ISSUE_OPENED, t('Gitlab issue opened'));
$this->eventManager->register(WebhookHandler::EVENT_ISSUE_CLOSED, t('Gitlab issue closed'));
$this->eventManager->register(WebhookHandler::EVENT_ISSUE_REOPENED, t('Gitlab issue reopened'));
$this->eventManager->register(WebhookHandler::EVENT_ISSUE_COMMENT, t('Gitlab issue comment created'));
}

public function getPluginName()
{
return 'Gitlab Webhook';
Expand All @@ -48,7 +49,7 @@ public function getPluginAuthor()

public function getPluginVersion()
{
return '1.0.2';
return '1.0.3';
}

public function getPluginHomepage()
Expand Down
4 changes: 2 additions & 2 deletions Template/project/integrations.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h3><img src="<?= $this->url->dir() ?>plugins/GitlabWebhook/gitlab-icon.png"/>&nbsp;<?= t('Gitlab webhooks') ?></h3>
<div class="listing">
<input type="text" class="auto-select" readonly="readonly" value="<?= $this->url->href('webhook', 'handler', array('plugin' => 'GitlabWebhook', 'token' => $webhook_token, 'project_id' => $project['id']), false, '', true) ?>"/><br/>
<p class="form-help"><a href="http://kanboard.net/plugins/gitlab-webhook" target="_blank"><?= t('Help on Gitlab webhooks') ?></a></p>
</div>
<p class="form-help"><a href="https://kanboard.net/plugin/gitlab-webhook" target="_blank"><?= t('Help on Gitlab webhooks') ?></a></p>
</div>
1 change: 1 addition & 0 deletions Test/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public function testPlugin()
{
$plugin = new Plugin($this->container);
$this->assertSame(null, $plugin->initialize());
$this->assertSame(null, $plugin->onStartup());
$this->assertNotEmpty($plugin->getPluginName());
$this->assertNotEmpty($plugin->getPluginDescription());
$this->assertNotEmpty($plugin->getPluginAuthor());
Expand Down

0 comments on commit 7e1ad3f

Please sign in to comment.