[Bps-public-commit] rt-extension-notifyslack branch, master, updated. 3d65ec5ca3b5d0217f3ac921049fcdd20436d184
Maureen Mirville
maureen at bestpractical.com
Mon Jul 23 09:44:10 EDT 2018
The branch, master has been updated
via 3d65ec5ca3b5d0217f3ac921049fcdd20436d184 (commit)
via a8343dde72ffcf45d1291497a28e7040582f8f40 (commit)
from 1685f84705a60b2e59a91fa1072f6b8fb8f4c127 (commit)
Summary of changes:
README | 7 ++++++-
lib/RT/Action/NotifySlack.pm | 3 ++-
lib/RT/Extension/NotifySlack.pm | 6 +++++-
3 files changed, 13 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit a8343dde72ffcf45d1291497a28e7040582f8f40
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date: Mon Jul 23 09:41:22 2018 -0400
Add example of %SlackWebHookUrls config to docs
diff --git a/README b/README
index 49d169b..f6de98c 100644
--- a/README
+++ b/README
@@ -36,7 +36,12 @@ INSTALLATION
CONFIGURATION
You must add the desired Slack channels and webhook URLs to the RT
%SlackWebHookUrls config value in RT_SiteConfig.pm. These values can be
- retrieved from Slack's API Incoming Webhooks configuration settings.
+ retrieved from Slack's API Incoming Webhooks configuration settings. See
+ example below:
+
+ Set( %SlackWebHookUrls,
+ '#channel' => 'https://myslackwebhookurl...',
+ );
The 'Notify Slack' ScripAction posts to one Slack channel. The default
Slack channel is currently set to #general. You can update this in the
diff --git a/lib/RT/Extension/NotifySlack.pm b/lib/RT/Extension/NotifySlack.pm
index 4455bd5..4e7c2d4 100644
--- a/lib/RT/Extension/NotifySlack.pm
+++ b/lib/RT/Extension/NotifySlack.pm
@@ -66,7 +66,11 @@ Add this line:
You must add the desired Slack channels and webhook URLs to the
RT %SlackWebHookUrls config value in RT_SiteConfig.pm. These values
can be retrieved from Slack's API Incoming Webhooks configuration
-settings.
+settings. See example below:
+
+ Set( %SlackWebHookUrls,
+ '#channel' => 'https://myslackwebhookurl...',
+ );
The 'Notify Slack' ScripAction posts to one Slack channel. The default
Slack channel is currently set to #general. You can update this in
commit 3d65ec5ca3b5d0217f3ac921049fcdd20436d184
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date: Mon Jul 23 09:42:51 2018 -0400
Code fix: if no slack webhook url is found, bail out immediately
diff --git a/lib/RT/Action/NotifySlack.pm b/lib/RT/Action/NotifySlack.pm
index 681fbc0..d694dae 100644
--- a/lib/RT/Action/NotifySlack.pm
+++ b/lib/RT/Action/NotifySlack.pm
@@ -28,6 +28,8 @@ sub Commit {
$webhook_url = $webhook_urls->{ $key };
}
}
+ return RT::Logger->error( 'Slack channel: ' . $channel . ' not found. Check %SlackWebHookUrls config values.' ) unless $webhook_url;
+
my $ua = LWP::UserAgent->new;
$ua->timeout(15);
@@ -48,7 +50,6 @@ sub Commit {
my $payload = {
text => $slack_message,
};
- return RT::Logger->error( 'Slack channel: ' . $channel . ' not found. Check %SlackWebHookUrls config values.' ) unless $webhook_url;
my $req = POST("$webhook_url", ['payload' => encode_json($payload)]);
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list