[Rt-commit] rt branch, squish-refactor, created. rt-3.9.7-873-g24f7810

? sunnavy sunnavy at bestpractical.com
Tue Dec 14 07:59:17 EST 2010


The branch, squish-refactor has been created
        at  24f7810c6e90969fc9900c4f8ef79cc35543516c (commit)

- Log -----------------------------------------------------------------
commit 1c3d4b5c152efcee8e658f23e850f09a2384831a
Merge: dc0d9db 8bc1f21
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Mon Dec 13 19:03:35 2010 -0500

    Merge branch '3.9-menu_index_page' into 3.9-trunk


commit bc1b22ba50c2ed3a9671fc5bd98097490962b4e1
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Dec 13 19:53:22 2010 -0500

    Fix some =~ qr//s

diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index 775e362..efffc4c 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -271,7 +271,7 @@ sub ticket_status {
     my $id = shift;
     
     $self->display_ticket( $id);
-    my ($got) = ($self->content =~ qr{Status:\s*</td>\s*<td[^>]*?class="value"[^>]*?>\s*([\w ]+?)\s*</td>}ism);
+    my ($got) = ($self->content =~ m{Status:\s*</td>\s*<td[^>]*?class="value"[^>]*?>\s*([\w ]+?)\s*</td>}ism);
     unless ( $got ) {
         Test::More::diag("Error: couldn't find status value on the page, may be regexp problem");
     }
diff --git a/t/web/offline_messages_utf8.t b/t/web/offline_messages_utf8.t
index 6894d6b..582cc27 100644
--- a/t/web/offline_messages_utf8.t
+++ b/t/web/offline_messages_utf8.t
@@ -38,7 +38,7 @@ EOF
         button    => 'UpdateTickets',
     );
     my $content = encode 'utf8', $m->content;
-    ok( $content =~ qr/申請單 #(\d+) 成功新增於 &#39;General&#39; 表單/, 'message is shown right' );
+    ok( $content =~ m/申請單 #(\d+) 成功新增於 &#39;General&#39; 表單/, 'message is shown right' );
     $ticket_id = $1;
 }
 

commit 837152112df456da10114c56c14215193bcc478c
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Dec 13 20:04:07 2010 -0500

    Remove Timezone from install wizard [issues.bestpractical.com #16178]

diff --git a/share/html/Install/Global.html b/share/html/Install/Global.html
index ef9d5fa..a832833 100644
--- a/share/html/Install/Global.html
+++ b/share/html/Install/Global.html
@@ -53,7 +53,6 @@
 
 <p><&|/l&>When RT sends an email it sets the From: and Reply-To: headers so users can add to the conversation by just hitting Reply in their mail client.  It uses different addresses for Replies and Comments.  These can be changed for each of your queues.  These addresses will need to be configured to use the <tt>rt-mailgate</tt> program.</&></p>
 
-<p><&|/l&>By default, RT will use the timezone of your system.  This lets you set a global default for the display of dates and times in RT.  Your users can choose a different Timezone in their preferences.</&></p>
 <form method="post">
 <& /Widgets/BulkEdit, Types => \@Types,Meta => $RT::Installer->{Meta},
     CurrentValue => RT::Installer->CurrentValues(@Types)
@@ -70,7 +69,7 @@
 <%init>
 my @errors;
 
-my @Types = qw/CommentAddress CorrespondAddress Timezone/;
+my @Types = qw/CommentAddress CorrespondAddress/;
 
 if ( $Run ) {
 
diff --git a/share/html/Install/index.html b/share/html/Install/index.html
index e1535fe..cc94003 100644
--- a/share/html/Install/index.html
+++ b/share/html/Install/index.html
@@ -110,7 +110,7 @@ elsif ( $Run ) {
     for my $field  (
             qw/DatabaseType DatabaseName DatabaseHost DatabasePort
             DatabaseUser DatabaseRequireSSL rtname
-            Organization Timezone CommentAddress CorrespondAddress 
+            Organization CommentAddress CorrespondAddress
             SendmailPath WebDomain WebPort/
     ) {
         $RT::Installer->{InstallConfig}{$field} ||= RT->Config->Get($field);

commit f779a94ab9349db3e56d6bbb95e01042912134fe
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Dec 13 22:36:40 2010 -0500

    use =~ m{} instead of =~ qr{}

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 80df6b7..f4e3957 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -58,7 +58,7 @@ my $query_string = sub {
     return $u->query;
 };
 
-if ( $request_path !~ qr{^/SelfService/} ) {
+if ( $request_path !~ m{^/SelfService/} ) {
     my $home = Menu->child( home => title => loc('Homepage'), path => '/' );
     my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
     my $limit      = 7;
@@ -243,7 +243,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
               || RT->Config->Get('WebFallbackToInternalAuth') )) {
         $about_me->child( logout => title => loc('Logout'), path   => '/NoAuth/Logout.html' );
     }
-    if ( $request_path =~ qr{^/Dashboards/(\d+)?}) {
+    if ( $request_path =~ m{^/Dashboards/(\d+)?}) {
         if ( my $id = ( $1 || $m->request_args->{'id'} ) ) {
             my $obj = RT::Dashboard->new( $session{'CurrentUser'} );
             $obj->LoadById($id);
@@ -259,7 +259,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
         }
     }
 
-    if ( $request_path =~ qr{^/Admin/(Queues|Users|Groups|CustomFields)} ) {
+    if ( $request_path =~ m{^/Admin/(Queues|Users|Groups|CustomFields)} ) {
         my $type = $1;
         my $tabs = PageMenu();
 
@@ -272,8 +272,8 @@ if ( $request_path !~ qr{^/SelfService/} ) {
                      );
 
         my $section;
-        if ( $request_path =~ qr{^/Admin/$type/?(?:index.html)?$}
-             || (    $request_path =~ qr{^/Admin/$type/(?:Modify.html)$}
+        if ( $request_path =~ m{^/Admin/$type/?(?:index.html)?$}
+             || (    $request_path =~ m{^/Admin/$type/(?:Modify.html)$}
                   && $m->request_args->{'Create'} )
            )
 
@@ -291,7 +291,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
                          path => "/Admin/$type/Modify.html?Create=1" );
     }
 
-    if ( $request_path =~ qr{^/Admin/Queues} ) {
+    if ( $request_path =~ m{^/Admin/Queues} ) {
         if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ 
                 ||
               $m->request_args->{'Queue'} && $m->request_args->{'Queue'} =~ /^\d+$/ 
@@ -329,7 +329,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
 
         }
     }
-    if ( $request_path =~ qr{^/Admin/Users} ) {
+    if ( $request_path =~ m{^/Admin/Users} ) {
         if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) {
             my $id = $m->request_args->{'id'};
             my $obj = RT::User->new( $session{'CurrentUser'} );
@@ -346,7 +346,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
 
     }
 
-    if ( $request_path =~ qr{^/Admin/Groups} ) {
+    if ( $request_path =~ m{^/Admin/Groups} ) {
         if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) {
             my $id = $m->request_args->{'id'};
             my $obj = RT::Group->new( $session{'CurrentUser'} );
@@ -360,7 +360,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
         }
     }
 
-    if ( $request_path =~ qr{^/Admin/CustomFields/} ) {
+    if ( $request_path =~ m{^/Admin/CustomFields/} ) {
         if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) {
             my $id = $m->request_args->{'id'};
             my $obj = RT::CustomField->new( $session{'CurrentUser'} );
@@ -377,7 +377,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
 
     }
 
-    if ( $request_path =~ qr{^/Admin/Global/(Scrip|Template)s?\.html} ) {
+    if ( $request_path =~ m{^/Admin/Global/(Scrip|Template)s?\.html} ) {
         my $type = $1;
         my $tabs = PageMenu();
 
@@ -396,7 +396,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
 
     }
 
-    if ( $request_path =~ qr{^/Admin/Articles/Classes/} ) {
+    if ( $request_path =~ m{^/Admin/Articles/Classes/} ) {
         if ( my $id = $m->request_args->{'id'} ) {
             my $obj = RT::CustomField->new( $session{'CurrentUser'} );
             $obj->Load($id);
@@ -411,7 +411,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
 
     }
 
-    if ( $request_path =~ qr{^/Ticket/} ) {
+    if ( $request_path =~ m{^/Ticket/} ) {
         if ( ( $m->request_args->{'id'} || '' ) =~ /^(\d+)$/ ) {
             my $id  = $1;
             my $obj = RT::Ticket->new( $session{'CurrentUser'} );
@@ -545,7 +545,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
             }
         }
     }
-    if ( $request_path =~ qr{^/(?:Ticket|Search)/} && $request_path !~ qr{^/Search/Simple\.html}) {
+    if ( $request_path =~ m{^/(?:Ticket|Search)/} && $request_path !~ m{^/Search/Simple\.html}) {
         my $search = Menu()->child('search');
         my $args      = '';
         my $has_query = '';
@@ -576,7 +576,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
 
 
         my $current_search_menu;
-        if ( $request_path =~ qr{^/Ticket} ) {
+        if ( $request_path =~ m{^/Ticket} ) {
             $current_search_menu = $search->child( current_search => title => loc('Current Search') );
             $current_search_menu->path("/Search/Results.html$args") if $has_query;
         } else {
@@ -586,7 +586,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
                                      path => "/Search/Build.html" . ( ($has_query) ? $args : '' ) );
         $current_search_menu->child( loc('Advanced') => path => "/Search/Edit.html$args" );
         if ($has_query) {
-            if ($request_path =~ qr{^/Search/Results.html}
+            if ($request_path =~ m{^/Search/Results.html}
                 &&                        #XXX TODO better abstraction
                 $session{'CurrentUser'}->HasRight( Right => 'SuperUser', Object => $RT::System )) {
                 my $shred_args = $query_string->(
@@ -630,7 +630,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
 }
     }
 
-    if ( $request_path =~ qr{^/Article/} ) {
+    if ( $request_path =~ m{^/Article/} ) {
         if ( $m->request_args->{'id'} && $m->request_args->{'id'} =~ /^\d+$/ ) {
             my $id = $m->request_args->{'id'};
             my $tabs = PageMenu();
@@ -642,7 +642,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
         }
     }
 
-    if ( $request_path =~ qr{^/Articles/} ) {
+    if ( $request_path =~ m{^/Articles/} ) {
         my $tabs = PageMenu();
         $tabs->child( search => path => "/Articles/Article/Search.html", title     => loc("Search") );
         $tabs->child( create => path => "/Articles/Article/PreCreate.html", title     => loc("New Article" ) );
@@ -674,7 +674,7 @@ if ( $request_path !~ qr{^/SelfService/} ) {
     $m->callback( CallbackName => 'Privileged' );
 }
 
-if ( $request_path =~ qr{^/SelfService} ) {
+if ( $request_path =~ m{^/SelfService} ) {
 
     my $queues = RT::Queues->new( $session{'CurrentUser'} );
     $queues->FindAllRows;

commit d490a61f81d7f4c1bc2d084ebdebc44bbc0066a0
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Dec 13 22:37:16 2010 -0500

    Kill one more !~ qr{}

diff --git a/lib/RT/Base.pm b/lib/RT/Base.pm
index fc746c6..6eecc09 100755
--- a/lib/RT/Base.pm
+++ b/lib/RT/Base.pm
@@ -158,7 +158,7 @@ sub _ImportOverlays {
     for (qw(Overlay Vendor Local)) {
         my $filename = $package."_".$_.".pm";
         eval { require $filename };
-        die $@ if ($@ && $@ !~ qr{^Can't locate $filename});
+        die $@ if ($@ && $@ !~ m{^Can't locate $filename});
     }
 }
 

commit 7c074a6be00af4efd66fbcaf161778b55bfcb06f
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Dec 13 22:45:39 2010 -0500

    Improve some =~ '' syntax

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index d64d140..2f3a451 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -22,7 +22,7 @@ my $form = $m->form_name('Dashboard-Searches-body');
 my @input = $form->find_input('Searches-body-Available');
 my ($dashboards_component) =
   map { ( $_->possible_values )[1] }
-  grep { ( $_->value_names )[1] =~ 'Dashboards' } @input;
+  grep { ( $_->value_names )[1] =~ /Dashboards/ } @input;
 $form->value('Searches-body-Available' => $dashboards_component );
 $m->click_button(name => 'add');
 $m->content_contains('Dashboard updated');
diff --git a/t/web/dashboards.t b/t/web/dashboards.t
index ae3af6e..f1aabb3 100644
--- a/t/web/dashboards.t
+++ b/t/web/dashboards.t
@@ -93,7 +93,7 @@ my $form = $m->form_name('Dashboard-Searches-body');
 my @input = $form->find_input('Searches-body-Available');
 my ($unowned) =
   map { ( $_->possible_values )[1] }
-  grep { ( $_->value_names )[1] =~ 'Saved Search: Unowned Tickets' } @input;
+  grep { ( $_->value_names )[1] =~ /Saved Search: Unowned Tickets/ } @input;
 $form->value('Searches-body-Available' => $unowned );
 $m->click_button(name => 'add');
 $m->content_contains("Dashboard updated");
@@ -115,7 +115,7 @@ $form = $m->form_name('Dashboard-Searches-body');
 @input = $form->find_input('Searches-body-Available');
 my ($my_tickets) =
   map { ( $_->possible_values )[1] }
-  grep { ( $_->value_names )[1] =~ 'Saved Search: My Tickets' } @input;
+  grep { ( $_->value_names )[1] =~ /Saved Search: My Tickets/ } @input;
 $form->value('Searches-body-Available' => $my_tickets );
 $m->field('Searches-body-Available' => ["search-2-RT::System-1"]);
 $m->click_button(name => 'add');
@@ -237,7 +237,7 @@ $form = $m->form_name('Dashboard-Searches-body');
 @input = $form->find_input('Searches-body-Available');
 my ($personal) =
   map { ( $_->possible_values )[1] }
-  grep { ( $_->value_names )[1] =~ 'Saved Search: personal search' } @input;
+  grep { ( $_->value_names )[1] =~ /Saved Search: personal search/ } @input;
 $form->value('Searches-body-Available' => $personal );
 $m->click_button(name => 'add');
 $m->content_contains("Dashboard updated");

commit d189694efedd260341d1c2759399c38a36a8dce9
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Dec 14 13:17:57 2010 +0800

    logic fix: do *not* encode to utf8 if decode_utf8 is true

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 96c679b..5fc8f42 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -628,10 +628,15 @@ sub __Value {
 
     my $value = $self->SUPER::__Value($field);
 
-    if ( $args{'decode_utf8'} && !utf8::is_utf8($value) ) {
-        utf8::decode($value);
-    } elsif ( utf8::is_utf8($value) ) {
-        utf8::encode($value);
+    if ( $args{'decode_utf8'} ) {
+        if ( !utf8::is_utf8($value) ) {
+            utf8::decode($value);
+        }
+    }
+    else {
+        if ( utf8::is_utf8($value) ) {
+            utf8::encode($value);
+        }
     }
 
     return $value;

commit 2740286d3a1d99feca1582b141b0a770a9ee5e81
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Dec 14 13:18:26 2010 +0800

    filename is already utf8 encoded

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 368f793..da6040d 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1492,7 +1492,6 @@ sub MakeMIMEEntity {
             # Prefer the cached name first over CGI.pm stringification.
             my $filename = $RT::Mason::CGI::Filename;
             $filename = "$filehandle" unless defined $filename;
-            $filename = Encode::encode_utf8( $filename );
             $filename =~ s{^.*[\\/]}{};
 
             $Message->attach(

commit 24f7810c6e90969fc9900c4f8ef79cc35543516c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Dec 14 13:19:25 2010 +0800

    i18n test of attach file name with web ui

diff --git a/t/web/attachment_encoding.t b/t/web/attachment_encoding.t
index 38e4034..992be17 100644
--- a/t/web/attachment_encoding.t
+++ b/t/web/attachment_encoding.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 30;
+use RT::Test tests => 32;
 use Encode;
 my ( $baseurl, $m ) = RT::Test->started_ok;
 ok $m->login, 'logged in as root';
@@ -45,7 +45,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
 {
 
     my $file =
-      File::Spec->catfile( File::Spec->tmpdir, 'rt_attachemnt_abcde.txt' );
+      File::Spec->catfile( File::Spec->tmpdir, encode_utf8 '附件.txt' );
     open my $fh, '>', $file or die $!;
     binmode $fh, ':utf8';
     print $fh '附件';
@@ -59,6 +59,8 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
         fields => { Subject => '标题', Content => '测试', Attach => $file },
     );
     $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
+    $m->content_contains( '附件.txt', 'attached filename' );
+    $m->content_lacks( encode_utf8 '附件.txt', 'no double encoded attached filename' );
     $m->follow_link_ok( { text => 'with headers' },
         '-> /Ticket/Attachment/WithHeaders/...' );
 
@@ -98,4 +100,3 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
     unlink $file;
 }
 
-

-----------------------------------------------------------------------


More information about the Rt-commit mailing list