From 5bcba2b42c531a50c0017a262e879b0b42940b53 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Wed, 15 Aug 2012 17:38:53 -0400 Subject: Bug 782330 - Whine emails show the summary of security sensitive bugs r=gerv --- extensions/SecureMail/Extension.pm | 21 +++++++++++++++++++++ whine.pl | 3 +++ 2 files changed, 24 insertions(+) diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm index 64496a929..2138864e0 100644 --- a/extensions/SecureMail/Extension.pm +++ b/extensions/SecureMail/Extension.pm @@ -550,4 +550,25 @@ sub _filter_bug_links { }); } +sub whine_before_send { + my ($self, $args) = @_; + my $params = $args->{params}; + + return if !exists $params->{queries}; + + foreach my $query (@{ $params->{queries} }) { + foreach my $bug (@{ $query->{bugs} }) { + my $bug_obj = new Bugzilla::Bug($bug->{bug_id}); + next if !_should_secure_bug($bug_obj); + $bug->{priority} = '--'; + $bug->{bug_severity} = '--'; + $bug->{rep_platform} = '--'; + $bug->{assigned_to} = '--'; + $bug->{bug_status} = '--'; + $bug->{resolution} = '--'; + $bug->{'short_desc'} = "(Secure bug)"; + } + } +} + __PACKAGE__->NAME; diff --git a/whine.pl b/whine.pl index ad6067228..7e02a64e7 100755 --- a/whine.pl +++ b/whine.pl @@ -35,6 +35,7 @@ use Bugzilla::User; use Bugzilla::Mailer; use Bugzilla::Util; use Bugzilla::Group; +use Bugzilla::Hook; # create some handles that we'll need my $template = Bugzilla->template; @@ -367,6 +368,8 @@ sub mail { # Don't send mail to someone whose bugmail notification is disabled. return if $addressee->email_disabled; + Bugzilla::Hook::process('whine_before_send', { params => $args }); + my $template = Bugzilla->template_inner($addressee->setting('lang')); my $msg = ''; # it's a temporary variable to hold the template output $args->{'alternatives'} ||= []; -- cgit v1.2.3-24-g4f1b