summaryrefslogtreecommitdiffstats
path: root/extensions/RequestNagger/bin
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-10-30 07:58:13 +0100
committerByron Jones <bjones@mozilla.com>2013-10-30 07:58:13 +0100
commit1b28e5b941d480249d4dd637138a3781d6f9cd05 (patch)
treea69d86f0194417e096ceb1a460ca7d064403128c /extensions/RequestNagger/bin
parent7f7de14b517a953e83c97ec5a268613442826b8c (diff)
downloadbugzilla-1b28e5b941d480249d4dd637138a3781d6f9cd05.tar.gz
bugzilla-1b28e5b941d480249d4dd637138a3781d6f9cd05.tar.xz
Bug 892615: update requestnagging to suport securemail
Diffstat (limited to 'extensions/RequestNagger/bin')
-rwxr-xr-x[-rw-r--r--]extensions/RequestNagger/bin/send-request-nags.pl28
1 files changed, 27 insertions, 1 deletions
diff --git a/extensions/RequestNagger/bin/send-request-nags.pl b/extensions/RequestNagger/bin/send-request-nags.pl
index c62d91f03..93265b9ee 100644..100755
--- a/extensions/RequestNagger/bin/send-request-nags.pl
+++ b/extensions/RequestNagger/bin/send-request-nags.pl
@@ -21,6 +21,7 @@ use Bugzilla::Bug;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Extension::RequestNagger::Constants;
+use Bugzilla::Extension::RequestNagger::Bug;
use Bugzilla::Mailer;
use Bugzilla::User;
use Bugzilla::Util qw(format_time);
@@ -107,8 +108,30 @@ sub send_email {
my $vars = \%vars;
return unless $vars->{recipient} && @{ $vars->{requests} };
- # restructure the list to group by requestee then flag type
my $request_list = delete $vars->{requests};
+
+ # if securemail is installed, we need to encrypt or censor emails which
+ # contain non-public bugs
+ my $default_user = Bugzilla::User->new();
+ my $securemail = $vars->{recipient}->can('public_key');
+ my $has_key = $securemail && $vars->{recipient}->public_key;
+ # have to do this each time as objects are shared between requests
+ my $has_private_bug = 0;
+ foreach my $request (@{ $request_list }) {
+ # rebless bug objects into our subclass
+ bless($request->{bug}, 'Bugzilla::Extension::RequestNagger::Bug');
+ # and tell that object to hide the summary if required
+ if ($securemail && !$default_user->can_see_bug($request->{bug})) {
+ $has_private_bug = 1;
+ $request->{bug}->{secure_bug} = !$has_key;
+ }
+ else {
+ $request->{bug}->{secure_bug} = 0;
+ }
+ }
+ my $encrypt = $securemail && $has_private_bug && $has_key;
+
+ # restructure the list to group by requestee then flag type
my $requests = {};
my %seen_types;
foreach my $request (@{ $request_list }) {
@@ -172,6 +195,9 @@ sub send_email {
$email->content_type_set('multipart/alternative');
}
$email->parts_set(\@parts);
+ if ($encrypt) {
+ $email->header_set('X-Bugzilla-Encrypt' => '1');
+ }
# send
if ($DO_NOT_NAG) {