[Rt-commit] rt branch, 3.8.8-releng, updated. rt-3.8.7-337-g74428a7

Ruslan Zakirov ruz at bestpractical.com
Tue Apr 6 12:25:15 EDT 2010


The branch, 3.8.8-releng has been updated
       via  74428a7e5ee979a53996cf19b5f062b6281b3f7a (commit)
       via  dae897995bc1ec8af2a2a55634b4aa04675c6989 (commit)
       via  5ff5d0799db013fe2e30b07a6e36e31ce54b4995 (commit)
       via  91032e9c634c11bf7c7949b5e8a0d2d4de90cc8c (commit)
       via  7c4cdc483df1475f7a4277778c540c0ebef72de4 (commit)
       via  1f037faf564b7bcb804fa327f1db3b3bf3c26b18 (commit)
       via  8e536a2550dcb1e9caf21573d9291eb51b49371e (commit)
       via  3bc23af0bdc4394d457b58a790eb22fdf31a9a7e (commit)
       via  f94b385b394a561e3382330d35d82afd43c578c3 (commit)
      from  0dbbe8a30c96c518d80e80ad23625ea56950fb2d (commit)

Summary of changes:
 UPGRADING                      |   19 +++-
 etc/RT_Config.pm.in            |   34 ++-----
 lib/RT/Search/Googleish.pm     |  229 ++++++++++++++--------------------------
 lib/RT/Test/Web.pm             |   37 +++++--
 sbin/rt-test-dependencies.in   |    1 +
 share/html/NoAuth/Logout.html  |    2 +-
 share/html/Search/Results.html |    6 -
 t/api/emailparser.t            |   17 +---
 t/web/googleish_search.t       |  136 ------------------------
 9 files changed, 140 insertions(+), 341 deletions(-)
 delete mode 100644 t/web/googleish_search.t

- Log -----------------------------------------------------------------
commit f94b385b394a561e3382330d35d82afd43c578c3
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Apr 3 01:01:10 2010 +0400

    RTAddressRegexp is not defined these days

diff --git a/t/api/emailparser.t b/t/api/emailparser.t
index 4807138..940c26f 100644
--- a/t/api/emailparser.t
+++ b/t/api/emailparser.t
@@ -1,32 +1,19 @@
 
 use strict;
 use warnings;
-use RT;
+
 use RT::Test tests => 4;
 
+RT->Config->Set( RTAddressRegexp => qr/^rt\@example.com$/i );
 
-{
 
 ok(require RT::EmailParser);
 
-
-}
-
-{
-
 is(RT::EmailParser::IsRTAddress("","rt\@example.com"),1, "Regexp matched rt address" );
 is(RT::EmailParser::IsRTAddress("","frt\@example.com"),undef, "Regexp didn't match non-rt address" );
 
-
-}
-
-{
-
 my @before = ("rt\@example.com", "frt\@example.com");
 my @after = ("frt\@example.com");
 ok(eq_array(RT::EmailParser::CullRTAddresses("", at before), at after), "CullRTAddresses only culls RT addresses");
 
-
-}
-
 1;

commit 3bc23af0bdc4394d457b58a790eb22fdf31a9a7e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Apr 5 16:45:58 2010 +0400

    Revert "Merge remote branch 'origin/googleish-refactor' into 3.8-trunk"
    
    This reverts commit 979eb8c6140ae04becefcaadf32356a63ea1172e, reversing
    changes made to a9f1393c344a8e8f10ead7fd59e0041b5f44acee.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 5384493..3f415fc 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1522,28 +1522,6 @@ Set($DefaultTimeUnitsToHours, 0);
 
 =back
 
-=item C<$SearchResultsAutoRedirect>
-
-when only one ticket is found in search, use this to redirect to the ticket
-display page automatically.
-
-=cut
-
-Set($SearchResultsAutoRedirect, 0);
-
-=back
-
-=item C<$OnlySearchActiveTicketsInSimpleSearch>
-
-When query in simple search doesn't have status info,
-use this to only search active ones.
-
-=cut
-
-Set($OnlySearchActiveTicketsInSimpleSearch, 1);
-
-=back
-
 =head1 L<Net::Server> (rt-server) Configuration
 
 =over 4
diff --git a/lib/RT/Search/Googleish.pm b/lib/RT/Search/Googleish.pm
index ed28f70..4c14c47 100644
--- a/lib/RT/Search/Googleish.pm
+++ b/lib/RT/Search/Googleish.pm
@@ -96,179 +96,110 @@ sub QueryToSQL {
     my $query    = shift || $self->Argument;
 
     my @keywords = grep length, map { s/^\s+//; s/\s+$//; $_ }
-      split /((?:fulltext:)?$re_delim|\s+)/o, $query;
-
-    my (@keyvalue_clauses, @status_clauses, @other_clauses);
-
-    for my $keyword (@keywords) {
-        my @clauses;
-        if ( ( @clauses = $self->TranslateCustom($keyword) ) ||
-             ( @clauses = $self->TranslateKeyValue($keyword) ) ) {
-            push @keyvalue_clauses, @clauses;
-            next;
-        } elsif ( @clauses = $self->TranslateStatus($keyword) ) {
-            push @status_clauses, @clauses;
-            next;
+        split /((?:fulltext:)?$re_delim|\s+)/o, $query;
+
+    my (
+        @tql_clauses,  @owner_clauses, @queue_clauses,
+        @user_clauses, @id_clauses,    @status_clauses
+    );
+    my ( $Queue, $User );
+    for my $key (@keywords) {
+
+        # Is this a ticket number? If so, go to it.
+        # But look into subject as well
+        if ( $key =~ m/^\d+$/ ) {
+            push @id_clauses, "id = '$key'", "Subject LIKE '$key'";
         }
 
-        for my $action (qw/Number User Queue Owner Others/) {
-            my $translate = 'Translate' . $action;
-            if ( my @clauses = $self->$translate($keyword) ) {
-                push @other_clauses, @clauses;
-                next;
+        # if it's quoted string then search it "as is" in subject or fulltext
+        elsif ( $key =~ /^(fulltext:)?($re_delim)$/io ) {
+            if ( $1 ) {
+                push @tql_clauses, "Content LIKE $2";
+            } else {
+                push @tql_clauses, "Subject LIKE $2";
             }
         }
-    }
 
-    push @other_clauses, $self->ProcessExtraQueues;
-    unless (@status_clauses) {
-        push @status_clauses, $self->ProcessExtraStatus;
-    }
+        elsif ( $key =~ /^fulltext:(.*?)$/i ) {
+            $key = $1;
+            $key =~ s/['\\].*//g;
+            push @tql_clauses, "Content LIKE '$key'";
 
-    my @tql_clauses = join( " AND ", sort @keyvalue_clauses );    # Yes, AND!
-    push @tql_clauses, join( " OR ", sort @status_clauses );
-    push @tql_clauses, join( " OR ", sort @other_clauses );
-    @tql_clauses = grep { $_ ? $_ = "( $_ )" : undef } @tql_clauses;
-    return join " AND ", sort @tql_clauses;
-}
-
-# }}}
-
-# {{{ sub Prepare
-sub Prepare {
-    my $self = shift;
-    my $tql  = $self->QueryToSQL( $self->Argument );
-
-    $RT::Logger->debug($tql);
-
-    $self->TicketsObj->FromSQL($tql);
-    return (1);
-}
-
-# }}}
+        }
 
-sub TranslateKeyValue {
-    my $self = shift;
-    my $key  = shift;
+        elsif ( $key =~ /\w+\@\w+/ ) {
+            push @user_clauses, "Requestor LIKE '$key'";
+        }
 
-    if ( $key =~ /(subject|cf\.(?:[^:]*?)|content|requestor|id|status|owner|queue|fulltext):(['"]?)(.+)\2/i )
-    {
-        my $field = $1;
-        my $value = $3;
-        $value =~ s/(['"])/\\$1/g;
+        # Is there a status with this name?
+        elsif (
+            $Queue = RT::Queue->new( $self->TicketsObj->CurrentUser )
+            and $Queue->IsValidStatus($key)
+          )
+        {
+            push @status_clauses, "Status = '" . $key . "'";
+        }
 
-        if ( $field =~ /id|status|owner|queue/i ) {
-            return "$field = '$value'";
+        # Is there a queue named $key?
+        elsif ( $Queue = RT::Queue->new( $self->TicketsObj->CurrentUser )
+            and $Queue->Load($key)
+            and $Queue->id )
+        {
+            my $quoted_queue = $Queue->Name;
+            $quoted_queue =~ s/'/\\'/g;
+            push @queue_clauses, "Queue = '$quoted_queue'";
         }
-        elsif ( $field =~ /fulltext/i ) {
-            return "Content LIKE '$value'";
+
+        # Is there a owner named $key?
+        elsif ( $User = RT::User->new( $self->TicketsObj->CurrentUser )
+            and $User->Load($key)
+            and $User->id
+            and $User->Privileged )
+        {
+            push @owner_clauses, "Owner = '" . $User->Name . "'";
         }
+
+        # Else, subject must contain $key
         else {
-            return "$field LIKE '$value'";
+            $key =~ s/['\\].*//g;
+            push @tql_clauses, "Subject LIKE '$key'";
         }
     }
-    return;
-}
-
-sub TranslateNumber {
-    my $self = shift;
-    my $key  = shift;
-
-    if ( $key =~ /^\d+$/ ) {
-        return ("id = '$key'", "Subject LIKE '$key'");
-    }
-    return;
-}
-
-sub TranslateStatus {
-    my $self = shift;
-    my $key  = shift;
-
-    my $Queue = RT::Queue->new( $self->TicketsObj->CurrentUser );
-    if ( $Queue->IsValidStatus($key) ) {
-        return "Status = '$key'";
-    }
-    return;
-}
-
-sub TranslateQueue {
-    my $self = shift;
-    my $key  = shift;
-
-    my $Queue = RT::Queue->new( $self->TicketsObj->CurrentUser );
-    $Queue->Load($key);
-    if ( $Queue->id ) {
-        my $quoted_queue = $Queue->Name;
-        $quoted_queue =~ s/'/\\'/g;
-        return "Queue = '$quoted_queue'";
-    }
-    return;
-}
-
-sub TranslateUser {
-    my $self = shift;
-    my $key  = shift;
-
-    if ( $key =~ /\w+\@\w+/ ) {
-        $key =~ s/(['"])/\\$1/g;
-        return "Requestor LIKE '$key'";
-    }
-    return;
-}
-
-sub TranslateOwner {
-    my $self = shift;
-    my $key  = shift;
-
-    my $User = RT::User->new( $self->TicketsObj->CurrentUser );
-    $User->Load($key);
-    if ( $User->id && $User->Privileged ) {
-        my $name = $User->Name;
-        $name =~ s/(['"])/\\$1/g;
-        return "Owner = '" . $name . "'";
-    }
-    return;
-}
-
-sub TranslateOthers {
-    my $self = shift;
-    my $key  = shift;
-
-    $key =~ s{^(['"])(.*)\1$}{$2};    # 'foo' => foo
-    $key =~ s/(['"])/\\$1/g;          # foo'bar => foo\'bar
-
-    return "Subject LIKE '$key'";
-}
-
-sub ProcessExtraQueues {
-    my $self           = shift;
-    my %args           = @_;
 
     # restrict to any queues requested by the caller
-    my @clauses;
-    for my $queue ( @{ $self->{'Queues'} } ) {
-        my $QueueObj = RT::Queue->new( $self->TicketsObj->CurrentUser );
-        next unless $QueueObj->Load($queue);
+    for my $queue (@{ $self->{'Queues'} }) {
+        my $QueueObj = RT::Queue->new($self->TicketsObj->CurrentUser);
+        $QueueObj->Load($queue) or next;
         my $quoted_queue = $QueueObj->Name;
         $quoted_queue =~ s/'/\\'/g;
-        push @clauses, "Queue = '$quoted_queue'";
+        push @queue_clauses, "Queue = '$quoted_queue'";
     }
-    return @clauses;
-}
-
-sub ProcessExtraStatus {
-    my $self = shift;
 
-    if ( RT::Config->Get('OnlySearchActiveTicketsInSimpleSearch',$self->TicketsObj->CurrentUser) ) {
-          return join( " OR ", map "Status = '$_'", RT::Queue->ActiveStatusArray() );
+    push @tql_clauses, join( " OR ", sort @id_clauses );
+    push @tql_clauses, join( " OR ", sort @owner_clauses );
+    if ( ! @status_clauses ) {
+        push @tql_clauses, join( " OR ", map "Status = '$_'", RT::Queue->ActiveStatusArray());
+    } else {
+        push @tql_clauses, join( " OR ", sort @status_clauses );
     }
-    return;
+    push @tql_clauses, join( " OR ", sort @user_clauses );
+    push @tql_clauses, join( " OR ", sort @queue_clauses );
+    @tql_clauses = grep { $_ ? $_ = "( $_ )" : undef } @tql_clauses;
+    return join " AND ", sort @tql_clauses;
 }
+# }}}
 
-sub TranslateCustom {
-    my $self = shift;
-    return;
+# {{{ sub Prepare
+sub Prepare  {
+  my $self = shift;
+  my $tql = $self->QueryToSQL($self->Argument);
+
+  $RT::Logger->debug($tql);
+
+  $self->TicketsObj->FromSQL($tql);
+  return(1);
 }
+# }}}
 
 eval "require RT::Search::Googleish_Vendor";
 die $@ if ($@ && $@ !~ qr{^Can't locate RT/Search/Googleish_Vendor.pm});
diff --git a/share/html/Search/Results.html b/share/html/Search/Results.html
index 92c9f10..22858f1 100755
--- a/share/html/Search/Results.html
+++ b/share/html/Search/Results.html
@@ -186,12 +186,6 @@ my $genpage = sub {
         Page    => shift(@_),
     );
 };
-
-if ( RT->Config->Get('SearchResultsAutoRedirect') && $ticketcount == 1 ) {
-    RT::Interface::Web::Redirect( RT->Config->Get('WebURL')
-            ."Ticket/Display.html?id=". $session{tickets}->First->id );
-}
-
 my $BaseURL = RT->Config->Get('WebPath')."/Search/Results.html?";
 $link_rel{first} = $BaseURL . $genpage->(1)         if $Page > 1;
 $link_rel{prev}  = $BaseURL . $genpage->($Page - 1) if $Page > 1;
diff --git a/t/web/googleish_search.t b/t/web/googleish_search.t
deleted file mode 100644
index 6afc2f5..0000000
--- a/t/web/googleish_search.t
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/usr/bin/env perl
-use strict;
-use warnings;
-
-use RT::Test tests => 61;
-my ($baseurl, $m) = RT::Test->started_ok;
-my $url = $m->rt_base_url;
-
-my $queue = RT::Queue->new($RT::SystemUser);
-$queue->Create( Name => 'other' );
-ok( $queue->id, 'created queue other');
-
-my $ticket_found_1 = RT::Ticket->new($RT::SystemUser);
-my $ticket_found_2 = RT::Ticket->new($RT::SystemUser);
-my $ticket_not_found = RT::Ticket->new($RT::SystemUser);
-
-$ticket_found_1->Create(
-    Subject   => 'base ticket 1'.$$,
-    Queue     => 'general',
-    Owner     => 'root',
-    Requestor => 'customsearch at localhost',
-    Content   => 'this is base ticket 1',
-);
-ok( $ticket_found_1->id, 'created ticket for custom search');
-
-
-$ticket_found_2->Create(
-    Subject   => 'base ticket 2'.$$,
-    Queue     => 'general',
-    Owner     => 'root',
-    Requestor => 'customsearch at localhost',
-    Content   => 'this is base ticket 2',
-);
-ok( $ticket_found_2->id, 'created ticket for custom search');
-
-$ticket_not_found = RT::Ticket->new($RT::SystemUser);
-$ticket_not_found->Create(
-    Subject   => 'not found subject' . $$,
-    Queue     => 'other',
-    Owner     => 'nobody',
-    Requestor => 'notfound at localhost',
-    Content   => 'this is not found content',
-);
-ok( $ticket_not_found->id, 'created ticket for custom search');
-
-ok($m->login, 'logged in');
-
-my @queries = (
-    'base ticket',            'root',
-    'customsearch at localhost', 'requestor:customsearch',
-    'subject:base',           'subject:"base ticket"',
-    'queue:general',          'owner:root',
-);
-
-for my $q (@queries) {
-    $m->form_with_fields('q');
-    $m->field( q => $q );
-    $m->submit;
-    $m->content_contains( 'base ticket 1', 'base ticket 1 is found' );
-    $m->content_contains( 'base ticket 2', 'base ticket 2 is found' );
-    $m->content_lacks( 'not found subject', 'not found ticket is not found' );
-}
-
-$ticket_not_found->SetStatus('open');
-is( $ticket_not_found->Status, 'open', 'status of not found ticket is open' );
- at queries = qw/new status:new/;
-for my $q (@queries) {
-    $m->form_with_fields('q');
-    $m->field( q => $q );
-    $m->submit;
-    $m->content_contains( 'base ticket 1', 'base ticket 1 is found' );
-    $m->content_contains( 'base ticket 2', 'base ticket 2 is found' );
-    $m->content_lacks( 'not found subject', 'not found ticket is not found' );
-}
-
- at queries = ( 'fulltext:"base ticket 1"', "'base ticket 1'" );
-for my $q (@queries) {
-    $m->form_with_fields('q');
-    $m->field( q => $q );
-    $m->submit;
-    $m->content_contains( 'base ticket 1', 'base ticket 1 is found' );
-    $m->content_lacks( 'base ticket 2',     'base ticket 2 is not found' );
-    $m->content_lacks( 'not found subject', 'not found ticket is not found' );
-}
-
-# now let's test with ' or "
-for my $quote ( q{'}, q{"} ) {
-    my $user = RT::User->new($RT::SystemUser);
-    is( ref($user), 'RT::User' );
-    my ( $id, $msg ) = $user->Create(
-        Name         => qq!foo${quote}bar!,
-        EmailAddress => qq!foo${quote}bar$$\@example.com !,
-        Privileged   => 1,
-    );
-    ok ($id, "Creating user - " . $msg );
-
-    my ( $grantid, $grantmsg ) =
-      $user->PrincipalObj->GrantRight( Right => 'OwnTicket' );
-    ok( $grantid, $grantmsg );
-
-
-
-    my $ticket_quote = RT::Ticket->new($RT::SystemUser);
-    $ticket_quote->Create(
-        Subject   => qq!base${quote}ticket $$!,
-        Queue     => 'general',
-        Owner     => $user->Name,
-        Requestor => qq!custom${quote}search\@localhost!,
-        Content   => qq!this is base${quote}ticket with quote inside!,
-    );
-    ok( $ticket_quote->id, 'created ticket with quote for custom search' );
-
-    @queries = (
-        qq!fulltext:base${quote}ticket!,
-        "base${quote}ticket",
-        "owner:foo${quote}bar",
-        "foo${quote}bar",
-
-        # email doesn't allow " character
-        $quote eq q{'}
-        ? (
-            "requestor:custom${quote}search\@localhost",
-            "custom${quote}search\@localhost",
-          )
-        : (),
-    );
-    for my $q (@queries) {
-        $m->form_with_fields('q');
-        $m->field( q => $q );
-        $m->submit;
-        my $escape_quote = $quote;
-        RT::Interface::Web::EscapeUTF8(\$escape_quote);
-        $m->content_contains( "base${escape_quote}ticket",
-            "base${quote}ticket is found" );
-    }
-}

commit 8e536a2550dcb1e9caf21573d9291eb51b49371e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Apr 6 00:57:38 2010 +0400

    we use Log::Dispatch::Perl in tests

diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index a0c99a4..f6261fe 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -296,6 +296,7 @@ Test::Builder 0.77 # needed to fix TODO test
 IPC::Run3
 Test::MockTime
 HTTP::Server::Simple::Mason 0.13
+Log::Dispatch::Perl
 .
 
 $deps{'FASTCGI'} = [ text_to_hash( << '.') ];

commit 1f037faf564b7bcb804fa327f1db3b3bf3c26b18
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Apr 6 01:09:41 2010 +0400

    update description of the ChartFont config option

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 3f415fc..38a8696 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1456,9 +1456,13 @@ Set($DontSearchFileAttachments, undef);
 =item C<%ChartFont>
 
 The L<GD> module (which RT uses for graphs) uses a builtin font that doesn't
-have full Unicode support. You can use a particular TrueType font by setting
-$ChartFont to the absolute path of that font. Your GD library must have
-support for TrueType fonts to use this option.
+have full Unicode support. You can use a particular TrueType font per
+language by setting %ChartFont to (language =E<gt> the absolute path of a
+font) pairs. Your GD library must have support for TrueType fonts to use
+this option. If there is no entry for a language in the hash then font
+with 'others' key is used.
+
+RT is shipped with two TrueType fonts covering most available localizations.
 
 =cut
 

commit 7c4cdc483df1475f7a4277778c540c0ebef72de4
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Apr 6 01:12:30 2010 +0400

    update upgrading
    
    * document 3.8.8/content upgrade script
    * there are a lot new config options

diff --git a/UPGRADING b/UPGRADING
index d8962d3..7a1d64d 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -20,7 +20,15 @@ well.
 *******
 UPGRADING FROM 3.8.7 and earlier - Changes:
 
-New option ChartsTimezonesInDB in the config.
+ChartFont option has been changed from scalar to hash and fonts are
+shipped with RT. Either drop your customization or use new format.
+
+You can now order custom fields more precisly, but this requires unification
+in the current order values. After cleanup you should make sure that is order
+of custom fields is what you want and reorder them if needed. Cleanup will
+be done when you run:
+
+/opt/rt3/sbin/rt-setup-database --dba root --prompt-for-dba-password --action upgrade
 
 UPGRADING FROM 3.8.6 and earlier - Changes:
 

commit 91032e9c634c11bf7c7949b5e8a0d2d4de90cc8c
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Apr 5 17:23:05 2010 -0400

    update the language in UPGRADING

diff --git a/UPGRADING b/UPGRADING
index 7a1d64d..6acfa9c 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -20,15 +20,24 @@ well.
 *******
 UPGRADING FROM 3.8.7 and earlier - Changes:
 
-ChartFont option has been changed from scalar to hash and fonts are
-shipped with RT. Either drop your customization or use new format.
+RT's ChartFont option has been changed from a string to a hash which
+lets you specify per-language fonts. RT now comes with a better default
+font for charts, too.
 
-You can now order custom fields more precisly, but this requires unification
-in the current order values. After cleanup you should make sure that is order
-of custom fields is what you want and reorder them if needed. Cleanup will
-be done when you run:
+You should either update your 'ChartFont' option to match the new format
+or consider trying the new default
 
-/opt/rt3/sbin/rt-setup-database --dba root --prompt-for-dba-password --action upgrade
+RT now gives you more precise control over the order in which custom fields
+are displated.  This change requires some small changes to your currently saved
+custom field orders.
+
+RT will automatically clean up your existing custom fields when you run:
+
+
+  /opt/rt3/sbin/rt-setup-database --dba root --prompt-for-dba-password --action upgrade
+
+After that cleanup, you should make sure that custom field's are ordered in
+a way that you and your users find pleasing.
 
 UPGRADING FROM 3.8.6 and earlier - Changes:
 

commit 5ff5d0799db013fe2e30b07a6e36e31ce54b4995
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Apr 5 21:07:56 2010 -0400

    Slight language tweaks to RT_Config.pm

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 38a8696..9bd809a 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1455,14 +1455,14 @@ Set($DontSearchFileAttachments, undef);
 
 =item C<%ChartFont>
 
-The L<GD> module (which RT uses for graphs) uses a builtin font that doesn't
-have full Unicode support. You can use a particular TrueType font per
-language by setting %ChartFont to (language =E<gt> the absolute path of a
-font) pairs. Your GD library must have support for TrueType fonts to use
-this option. If there is no entry for a language in the hash then font
-with 'others' key is used.
-
-RT is shipped with two TrueType fonts covering most available localizations.
+The L<GD> module (which RT uses for graphs) ships with a builtin font 
+that doesn't have full Unicode support. You can use a given TrueType font 
+for a specific language by setting %ChartFont to (language =E<gt> the 
+absolute path of a font) pairs. Your GD library must have support for
+TrueType fonts to use this option. If there is no entry for a language 
+in the hash then font with 'others' key is used.
+
+RT comes with two TrueType fonts covering most available languages.
 
 =cut
 

commit dae897995bc1ec8af2a2a55634b4aa04675c6989
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Apr 6 15:29:07 2010 +0400

    use more checks in tests' login and logout functions

diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index 9e3d6ae..fb31797 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -76,23 +76,46 @@ sub login {
     my $self = shift;
     my $user = shift || 'root';
     my $pass = shift || 'password';
+    
+    $self->logout;
 
     my $url = $self->rt_base_url;
+    $self->get($url . "?user=$user;pass=$pass");
+    unless ( $self->status == 200 ) {
+        Test::More::diag( "error: status is ". $self->status );
+        return 0;
+    }
+    unless ( $self->content =~ qr/Logout/i ) {
+        Test::More::diag("error: page has no Logout");
+        return 0;
+    }
+    unless ( $self->content =~ m{<span>\Q$user\E</span>}i ) {
+        Test::More::diag("Page has no user name");
+        return 0;
+    }
+    return 1;
+}
 
+sub logout {
+    my $self = shift;
+
+    my $url = $self->rt_base_url;
     $self->get($url);
     Test::More::diag( "error: status is ". $self->status )
         unless $self->status == 200;
+
     if ( $self->content =~ qr/Logout/i ) {
         $self->follow_link( text => 'Logout' );
+        Test::More::diag( "error: status is ". $self->status ." when tried to logout" )
+            unless $self->status == 200;
     }
-
-    $self->get($url . "?user=$user;pass=$pass");
-    unless ( $self->status == 200 ) {
-        Test::More::diag( "error: status is ". $self->status );
-        return 0;
+    else {
+        return 1;
     }
-    unless ( $self->content =~ qr/Logout/i ) {
-        Test::More::diag("error: page has no Logout");
+
+    $self->get($url);
+    if ( $self->content =~ qr/Logout/i ) {
+        Test::More::diag( "error: couldn't logout" );
         return 0;
     }
     return 1;

commit 74428a7e5ee979a53996cf19b5f062b6281b3f7a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Apr 6 15:47:24 2010 +0400

    defined(%session) is deprecated

diff --git a/share/html/NoAuth/Logout.html b/share/html/NoAuth/Logout.html
index 9f01aa2..7b80823 100755
--- a/share/html/NoAuth/Logout.html
+++ b/share/html/NoAuth/Logout.html
@@ -70,7 +70,7 @@
 my $URL = RT->Config->Get('WebPath')."/";
 $m->callback( %ARGS, CallbackName => 'BeforeSessionDelete' );
 
-if (defined %session) {
+if (keys %session) {
     tied(%session)->delete;
     $session{'CurrentUser'} = RT::CurrentUser->new;
 }

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


More information about the Rt-commit mailing list