about summary refs log tree commit diff
path: root/lib/jitterbug
diff options
context:
space:
mode:
authorJonathan "Duke" Leto <jonathan@leto.net>2011-02-23 15:15:45 -0800
committerJonathan "Duke" Leto <jonathan@leto.net>2011-02-23 23:29:28 +0000
commit3527de189fc88d0fd3f2cfda153dc1d723dfa25a (patch)
treef9af49e2bedb2bf5dfdd6bf5548232c3daf708f7 /lib/jitterbug
parentUse checkout instead of rebase, since we don't know which branch name to reba... (diff)
downloadjitterbug-3527de189fc88d0fd3f2cfda153dc1d723dfa25a.tar.gz
Add on_failure_to_email and on_pass_to_email config keys
These keys can be used to override where pass/fail emails go. If they
are defined, emails are sent to the specified email. If not, they go
to the commit author.

This feature is sponsored by IRC insultbots and the letters B, A, C,
E and K.

No bits where harmed in the making of this feature.
Diffstat (limited to 'lib/jitterbug')
-rw-r--r--lib/jitterbug/Emailer.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/jitterbug/Emailer.pm b/lib/jitterbug/Emailer.pm
index 0d4d7da..d43b120 100644
--- a/lib/jitterbug/Emailer.pm
+++ b/lib/jitterbug/Emailer.pm
@@ -42,7 +42,6 @@ sub run {
     my $sha1      = $task->commit->sha256;
     my $shortsha1 = substr($sha1, 0, 8);
     my $desc      = JSON::decode_json( $task->commit->content );
-    my $email     = $desc->{'author'}{'email'};
     my $message   = $desc->{'message'};
     my $header    = $buildconf->{"on_${status}_header"};
     my $footer    = $buildconf->{"on_${status}_footer"};
@@ -60,6 +59,9 @@ sub run {
 
     my ($short_message) = split /\n/, $message;
 
+    # Default to the to_email specified in our config. If it isn't set,
+    # use the author email 
+    my $email = $buildconf->{"on_${status}_to_email"} || $desc->{'author'}{'email'};
 
     my $stuff = Email::Stuff->from($buildconf->{"on_${status}_from_email"})
                 # bug in Email::Stuff brakes chaining if $email is empty