summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/lib/Reports
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-10-21 09:46:30 +0200
committerByron Jones <bjones@mozilla.com>2013-10-21 09:46:30 +0200
commite3edbc52e592519697bfb0130a3ef13a7744a5d2 (patch)
tree3dda3c21c300429e06b42eb6e0c4f67d92103081 /extensions/BMO/lib/Reports
parent5d096b6f18c5e42f3246c9a652c276fabda5f6f3 (diff)
downloadbugzilla-e3edbc52e592519697bfb0130a3ef13a7744a5d2.tar.gz
bugzilla-e3edbc52e592519697bfb0130a3ef13a7744a5d2.tar.xz
Bug 910565: backport bug 877078 to bmo (shift bugmail generation to the jobqueue)
Diffstat (limited to 'extensions/BMO/lib/Reports')
-rw-r--r--extensions/BMO/lib/Reports/EmailQueue.pm25
1 files changed, 20 insertions, 5 deletions
diff --git a/extensions/BMO/lib/Reports/EmailQueue.pm b/extensions/BMO/lib/Reports/EmailQueue.pm
index 1bf2ca003..f1383aac7 100644
--- a/extensions/BMO/lib/Reports/EmailQueue.pm
+++ b/extensions/BMO/lib/Reports/EmailQueue.pm
@@ -39,11 +39,26 @@ sub report {
$vars->{'jobs'} = $dbh->selectall_arrayref($query, { Slice => {} });
foreach my $job (@{ $vars->{'jobs'} }) {
eval {
- my $msg = _cond_thaw(delete $job->{'arg'})->{msg};
- if (ref($msg) && blessed($msg) eq 'Email::MIME') {
- $job->{'subject'} = $msg->header('subject');
- } else {
- ($job->{'subject'}) = $msg =~ /\nSubject: ([^\n]+)/;
+ my ($recipient, $description);
+ my $arg = _cond_thaw(delete $job->{arg});
+
+ if (exists $arg->{vars}) {
+ my $vars = $arg->{vars};
+ $recipient = $vars->{to_user}->{login_name};
+ $description = '[Bug ' . $vars->{bug}->{bug_id} . '] ' . $vars->{bug}->{short_desc};
+ } elsif (exists $arg->{msg}) {
+ my $msg = $arg->{msg};
+ if (ref($msg) && blessed($msg) eq 'Email::MIME') {
+ $recipient = $msg->header('to');
+ $description = $msg->header('subject');
+ } else {
+ ($recipient) = $msg =~ /\nTo: ([^\n]+)/;
+ ($description) = $msg =~ /\nSubject: ([^\n]+)/;
+ }
+ }
+
+ if ($recipient) {
+ $job->{subject} = "<$recipient> $description";
}
};
}