summaryrefslogtreecommitdiff
path: root/app/Integration
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-05 12:52:44 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-05 12:52:44 -0400
commitaa2ca3342dc6783c7a0a679c11ac94213a7226bb (patch)
treea6ecc294d2e146fd25702299608889331e39f97c /app/Integration
parent0de269041389c0ab521de30ca2b878d242f691b8 (diff)
parentbc6b443c3db4f260bdc1460009c8110b54b3c257 (diff)
Merge pull-request #981
Diffstat (limited to 'app/Integration')
-rw-r--r--app/Integration/SlackWebhook.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/Integration/SlackWebhook.php b/app/Integration/SlackWebhook.php
index 975ea21f..a584c132 100644
--- a/app/Integration/SlackWebhook.php
+++ b/app/Integration/SlackWebhook.php
@@ -38,6 +38,23 @@ class SlackWebhook extends \Core\Base
$options = $this->projectIntegration->getParameters($project_id);
return $options['slack_webhook_url'];
}
+
+ /**
+ * Get optional Slack channel
+ *
+ * @access public
+ * @param integer $project_id
+ * @return string
+ */
+ public function getChannel($project_id)
+ {
+ if (!empty($this->config->get('integration_slack_webhook_channel'))) {
+ return $this->config->get('integration_slack_webhook_channel');
+ }
+
+ $options = $this->projectIntegration->getParameters($project_id);
+ return $options['slack_webhook_channel'];
+ }
/**
* Send message to the incoming Slack webhook
@@ -68,6 +85,11 @@ class SlackWebhook extends \Core\Base
$payload['text'] .= $this->helper->url->href('task', 'show', array('task_id' => $task_id, 'project_id' => $project_id));
$payload['text'] .= '|'.t('view the task on Kanboard').'>';
}
+
+ $channel = $this->getChannel($project_id);
+ if (!empty($channel)) {
+ $payload['channel'] = $channel;
+ }
$this->httpClient->postJson($this->getWebhookUrl($project_id), $payload);
}