summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dlawrence@mozilla.com>2011-10-05 22:38:47 +0200
committerDavid Lawrence <dlawrence@mozilla.com>2011-10-05 22:38:47 +0200
commit1d44809edc5e460f5c5035ebb272f1fe776465cc (patch)
treebe71e1a406799044449303b7a4c09854046efe08
parentbefdcc8f9a30f55e91227bac0ee1813a661002b3 (diff)
downloadbugzilla-1d44809edc5e460f5c5035ebb272f1fe776465cc.tar.gz
bugzilla-1d44809edc5e460f5c5035ebb272f1fe776465cc.tar.xz
Some more 4.2 porting fixes
-rw-r--r--Bugzilla/BugMail.pm8
-rw-r--r--Bugzilla/Install/DB.pm40
-rw-r--r--Bugzilla/Template.pm12
-rw-r--r--template/en/default/email/bugmail-header.txt.tmpl4
-rw-r--r--template/en/default/email/bugmail.txt.tmpl2
5 files changed, 41 insertions, 25 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index c637c3a66..60ff45e38 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -267,8 +267,12 @@ sub Send {
}
# Make sure the user isn't in the nomail list, and the dep check passed.
- # Upstreaming: when we port to 4.2, check the login names of the
- # user objects in the bugmail_recipients hook instead.
+ # BMO: normally we would check the login names of the
+ # user objects in the bugmail_recipients hook instead. There we could
+ # remove the (bugs|tld)$ addresses from the recipients. But the hook comes
+ # to early before watchers are decided and these addresses need to be
+ # there for this to work. This may change with recent enhancements to
+ # component watching. need to investigate further.
if ($user->email_enabled && $dep_ok &&
($user->login !~ /bugs$/) &&
($user->login !~ /\.tld$/))
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 1b6acce35..cdd4f8e96 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -3426,6 +3426,26 @@ sub _remove_attachment_isurl {
}
}
+sub _add_isactive_to_product_fields {
+ my $dbh = Bugzilla->dbh;
+
+ # If we add the isactive column all values should start off as active
+ if (!$dbh->bz_column_info('components', 'isactive')) {
+ $dbh->bz_add_column('components', 'isactive',
+ {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'});
+ }
+
+ if (!$dbh->bz_column_info('versions', 'isactive')) {
+ $dbh->bz_add_column('versions', 'isactive',
+ {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'});
+ }
+
+ if (!$dbh->bz_column_info('milestones', 'isactive')) {
+ $dbh->bz_add_column('milestones', 'isactive',
+ {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'});
+ }
+}
+
sub _migrate_field_visibility_value {
my $dbh = Bugzilla->dbh;
@@ -3587,26 +3607,6 @@ sub _rename_tags_to_tag {
}
}
-sub _add_isactive_to_product_fields {
- my $dbh = Bugzilla->dbh;
-
- # If we add the isactive column all values should start off as active
- if (!$dbh->bz_column_info('components', 'isactive')) {
- $dbh->bz_add_column('components', 'isactive',
- {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'});
- }
-
- if (!$dbh->bz_column_info('versions', 'isactive')) {
- $dbh->bz_add_column('versions', 'isactive',
- {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'});
- }
-
- if (!$dbh->bz_column_info('milestones', 'isactive')) {
- $dbh->bz_add_column('milestones', 'isactive',
- {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'TRUE'});
- }
-}
-
1;
__END__
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 433b283b2..ee8aa4309 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -663,6 +663,18 @@ sub create {
$var =~ s/>/\\x3e/g;
return $var;
},
+
+ # Sadly, different to the above. See http://www.json.org/
+ # for details.
+ json => sub {
+ my ($var) = @_;
+ $var =~ s/([\\\"\/])/\\$1/g;
+ $var =~ s/\n/\\n/g;
+ $var =~ s/\r/\\r/g;
+ $var =~ s/\f/\\f/g;
+ $var =~ s/\t/\\t/g;
+ return $var;
+ },
# Converts data to base64
base64 => sub {
diff --git a/template/en/default/email/bugmail-header.txt.tmpl b/template/en/default/email/bugmail-header.txt.tmpl
index 94559a942..85226b472 100644
--- a/template/en/default/email/bugmail-header.txt.tmpl
+++ b/template/en/default/email/bugmail-header.txt.tmpl
@@ -22,11 +22,13 @@
[% PROCESS "global/field-descs.none.tmpl" %]
[% PROCESS "global/reason-descs.none.tmpl" %]
+[% show_new = isnew
+ && (to_user.settings.bugmail_new_prefix.value == 'on') %]
[% isnew = bug.lastdiffed ? 0 : 1 %]
From: [% Param('mailfrom') %]
To: [% to_user.email %]
-Subject: [[% terms.Bug %] [%+ bug.id %]] [% 'New: ' IF isnew %][%+ bug.short_desc %]
+Subject: [[% terms.Bug %] [%+ bug.id %]] [% 'New: ' IF show_new %][%+ bug.short_desc %]
Date: [% date %]
X-Bugzilla-Reason: [% reasonsheader %]
X-Bugzilla-Type: [% isnew ? 'new' : 'changed' %]
diff --git a/template/en/default/email/bugmail.txt.tmpl b/template/en/default/email/bugmail.txt.tmpl
index 7c0bace4a..e890472ad 100644
--- a/template/en/default/email/bugmail.txt.tmpl
+++ b/template/en/default/email/bugmail.txt.tmpl
@@ -22,8 +22,6 @@
[% PROCESS "global/field-descs.none.tmpl" %]
[% PROCESS "global/reason-descs.none.tmpl" %]
-[% show_new = isnew
- && (to_user.settings.bugmail_new_prefix.value == 'on') %]
[% isnew = bug.lastdiffed ? 0 : 1 %]