From 1d44809edc5e460f5c5035ebb272f1fe776465cc Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 5 Oct 2011 16:38:47 -0400 Subject: Some more 4.2 porting fixes --- Bugzilla/BugMail.pm | 8 ++++++-- Bugzilla/Install/DB.pm | 40 ++++++++++++++++++++-------------------- Bugzilla/Template.pm | 12 ++++++++++++ 3 files changed, 38 insertions(+), 22 deletions(-) (limited to 'Bugzilla') 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 { -- cgit v1.2.3-24-g4f1b