From 270d4ce7fc25af173f36c4246310e1305975cb1f Mon Sep 17 00:00:00 2001 From: Reed Loden Date: Tue, 19 Jun 2012 10:02:28 -0700 Subject: Bug 765640 - Distinguish new bug filings from updates to existing ones [r=glob] --- extensions/SecureMail/Extension.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'extensions') diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm index 71eb470a2..c50ed2110 100644 --- a/extensions/SecureMail/Extension.pm +++ b/extensions/SecureMail/Extension.pm @@ -281,8 +281,13 @@ sub mailer_before_send { # does that. my $public_key = $user ? $user->{'public_key'} : ''; + # Check if the new bugmail prefix should be added to the subject. + my $add_new = ($email->header('X-Bugzilla-Type') eq 'new' && + $user && + $user->settings->{'bugmail_new_prefix'}->{'value'} eq 'on') ? 1 : 0; + if ($make_secure != SECURE_NONE) { - _make_secure($email, $public_key, $is_bugmail && $make_secure == SECURE_ALL); + _make_secure($email, $public_key, $is_bugmail && $make_secure == SECURE_ALL, $add_new); } } } @@ -313,7 +318,7 @@ sub _should_secure_bug { } sub _make_secure { - my ($email, $key, $sanitise_subject) = @_; + my ($email, $key, $sanitise_subject, $add_new) = @_; my $subject = $email->header('Subject'); my ($bug_id) = $subject =~ /\[\D+(\d+)\]/; @@ -409,7 +414,8 @@ sub _make_secure { # This is designed to still work if the admin changes the word # 'bug' to something else. However, it could break if they change # the format of the subject line in another way. - $subject =~ s/($bug_id\])\s+(.*)$/$1 (Secure bug $bug_id updated)/; + my $new = $add_new ? ' New:' : ''; + $subject =~ s/($bug_id\])\s+(.*)$/$1$new (Secure bug $bug_id updated)/; $email->header_set('Subject', $subject); } } -- cgit v1.2.3-24-g4f1b