summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReed Loden <reed@reedloden.com>2012-06-19 19:02:28 +0200
committerReed Loden <reed@reedloden.com>2012-06-19 19:02:28 +0200
commit270d4ce7fc25af173f36c4246310e1305975cb1f (patch)
tree0f8a032f0f2fc48b57c8624a4fe81f894bb81b7c
parente493bb7a74fd4f13327200ea917d1ba115f4c6e5 (diff)
downloadbugzilla-270d4ce7fc25af173f36c4246310e1305975cb1f.tar.gz
bugzilla-270d4ce7fc25af173f36c4246310e1305975cb1f.tar.xz
Bug 765640 - Distinguish new bug filings from updates to existing ones
[r=glob]
-rw-r--r--extensions/SecureMail/Extension.pm12
1 files changed, 9 insertions, 3 deletions
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);
}
}