From ce665b1f88150f437c7bb893bf3ebeabc3f04f07 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Fri, 6 Dec 2013 09:28:00 -0800 Subject: Bug 869989: Add X-Bugzilla-Mentors field to bugmail headers and an indication to mentors in bugmail body --- extensions/BMO/Extension.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'extensions/BMO/Extension.pm') diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 2235ebfea..4fd385861 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -860,6 +860,11 @@ sub mailer_before_send { _log_sent_email($email); + # $bug->mentors is added by the Review extension + if (Bugzilla::Bug->can('mentors')) { + _add_mentors_header($email); + } + # see bug 844724 if ($email->header('to') && $email->header('to') eq 'sync-1@bugzilla.tld') { $email->header_set('to', 'mei.kong@tcl.com'); @@ -945,6 +950,16 @@ sub _log_sent_email { _syslog("[bugmail] $recipient ($message_type) $bug_id $subject"); } +# Add X-Bugzilla-Mentors field to bugmail +sub _add_mentors_header { + my $email = shift; + return unless my $bug_id = $email->header('X-Bugzilla-ID'); + return unless my $bug = Bugzilla::Bug->new({ id => $bug_id, cache => 1 }); + return unless my $mentors = $bug->mentors; + return unless @$mentors; + $email->header_set('X-Bugzilla-Mentors', join(', ', map { $_->login } @$mentors)); +} + sub _syslog { my $message = shift; openlog('apache', 'cons,pid', 'local4'); -- cgit v1.2.3-24-g4f1b