diff options
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); } } |