diff options
author | Lesstat <florianbarth@gmx.de> | 2015-07-11 11:44:26 +0200 |
---|---|---|
committer | Lesstat <florianbarth@gmx.de> | 2015-07-11 11:44:26 +0200 |
commit | a85a1c613239c20fe72eb96c2921f4c220ec156b (patch) | |
tree | d032b4591e518cbbbfaa8886f8f5d98a6ea2efb7 /app/Integration | |
parent | 5101eaa8060ce3c75a81a26f6e47aae40e3d4ac3 (diff) | |
parent | 7e94d0ca233d15d6124c0adf3f956a119c82ccae (diff) |
Merged branch 'master' of https://github.com/fguillot/kanboard
only imports conflicted
Diffstat (limited to 'app/Integration')
-rw-r--r-- | app/Integration/SlackWebhook.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/Integration/SlackWebhook.php b/app/Integration/SlackWebhook.php index 975ea21f..498cea09 100644 --- a/app/Integration/SlackWebhook.php +++ b/app/Integration/SlackWebhook.php @@ -40,6 +40,25 @@ class SlackWebhook extends \Core\Base } /** + * Get optional Slack channel + * + * @access public + * @param integer $project_id + * @return string + */ + public function getChannel($project_id) + { + $channel = $this->config->get('integration_slack_webhook_channel'); + + if (! empty($channel)) { + return $channel; + } + + $options = $this->projectIntegration->getParameters($project_id); + return $options['slack_webhook_channel']; + } + + /** * Send message to the incoming Slack webhook * * @access public @@ -69,6 +88,11 @@ class SlackWebhook extends \Core\Base $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); } } |