[Rt-commit] rt branch, 4.0/lifecycle-case-comparisons, created. rt-4.0.13-42-g188333d

Thomas Sibley trs at bestpractical.com
Thu May 23 17:31:41 EDT 2013


The branch, 4.0/lifecycle-case-comparisons has been created
        at  188333d0f612fb488508ffd0cbe3bbb38e5ea2af (commit)

- Log -----------------------------------------------------------------
commit 622b072d71755d3754d5e1de6bd19bf23ed6be96
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu May 23 14:12:36 2013 -0700

    Restore case-insensitive de-duplication of statuses
    
    A refactoring of FillCache, 6eac780, removed the lc() from two de-duping
    statements, presumably in a premonition about the following commit,
    15857be, which forced statuses to lowercase.
    
    However, the next commit to follow that, 3af6cb0, introduced
    case-preservation for statuses while still keeping case-insensitivity.
    It neglected to add back the lc()s to the de-duping which became
    necessary once statuses could again vary in displayed case.

diff --git a/lib/RT/Lifecycle.pm b/lib/RT/Lifecycle.pm
index c905282..06a87c3 100644
--- a/lib/RT/Lifecycle.pm
+++ b/lib/RT/Lifecycle.pm
@@ -707,7 +707,7 @@ sub FillCache {
         }
 
         my %seen;
-        @statuses = grep !$seen{ $_ }++, @statuses;
+        @statuses = grep !$seen{ lc $_ }++, @statuses;
         $lifecycle->{''} = \@statuses;
 
         unless ( $lifecycle->{'transitions'}{''} ) {
@@ -767,7 +767,7 @@ sub FillCache {
 
     foreach my $type ( qw(initial active inactive), '' ) {
         my %seen;
-        @{ $all{ $type } } = grep !$seen{ $_ }++, @{ $all{ $type } };
+        @{ $all{ $type } } = grep !$seen{ lc $_ }++, @{ $all{ $type } };
         push @{ $all{''} }, @{ $all{ $type } } if $type;
     }
     $LIFECYCLES_CACHE{''} = \%all;

commit 188333d0f612fb488508ffd0cbe3bbb38e5ea2af
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu May 23 14:27:06 2013 -0700

    Compare the special "deleted" status case insensitively
    
    Statuses returned by RT::Lifecycle or RT::Ticket->Status are in
    canonical case rather than guaranteed lower case.  When comparing
    statuses, both operands should be lowercased.

diff --git a/lib/RT/Lifecycle.pm b/lib/RT/Lifecycle.pm
index 06a87c3..3731cdb 100644
--- a/lib/RT/Lifecycle.pm
+++ b/lib/RT/Lifecycle.pm
@@ -711,7 +711,7 @@ sub FillCache {
         $lifecycle->{''} = \@statuses;
 
         unless ( $lifecycle->{'transitions'}{''} ) {
-            $lifecycle->{'transitions'}{''} = [ grep $_ ne 'deleted', @statuses ];
+            $lifecycle->{'transitions'}{''} = [ grep lc $_ ne 'deleted', @statuses ];
         }
 
         my @actions;
diff --git a/lib/RT/Reminders.pm b/lib/RT/Reminders.pm
index 42f4e1d..719523b 100644
--- a/lib/RT/Reminders.pm
+++ b/lib/RT/Reminders.pm
@@ -122,7 +122,7 @@ sub Add {
         return ( 0, $self->loc( "Failed to load ticket [_1]", $self->Ticket ) );
     }
 
-    if ( $ticket->Status eq 'deleted' ) {
+    if ( lc $ticket->Status eq 'deleted' ) {
         return ( 0, $self->loc("Can't link to a deleted ticket") );
     }
 
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index ad0cf77..5acdb31 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -634,7 +634,7 @@ sub Create {
                 }
             }
 
-            if ( $obj && $obj->Status eq 'deleted' ) {
+            if ( $obj && lc $obj->Status eq 'deleted' ) {
                 push @non_fatal_errors,
                   $self->loc("Linking. Can't link to a deleted ticket");
                 next;
@@ -2591,7 +2591,7 @@ sub AddLink {
     }
 
     return ( 0, "Can't link to a deleted ticket" )
-      if $other_ticket && $other_ticket->Status eq 'deleted';
+      if $other_ticket && lc $other_ticket->Status eq 'deleted';
 
     return $self->_AddLink(%args);
 }
diff --git a/share/html/Elements/SelectStatus b/share/html/Elements/SelectStatus
index 2c4ea7e..7dda16e 100644
--- a/share/html/Elements/SelectStatus
+++ b/share/html/Elements/SelectStatus
@@ -54,7 +54,7 @@
 <optgroup label="<% $lifecycle %>">
 %     }
 %     foreach my $status (@{$statuses_by_lifecycle{$lifecycle}}) {
-%         next if ($SkipDeleted && $status eq 'deleted');
+%         next if ($SkipDeleted && lc $status eq 'deleted');
 %         my $selected = defined $Default && $status eq $Default ? 'selected="selected"' : '';
 <option value="<% $status %>" <% $selected |n %>><% loc($status) %></option>
 %     }
diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index 0bced1e..a48876b 100644
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -82,7 +82,7 @@ if ($id ne 'new') {
         return [ "# Ticket $id does not exist.", [], {}, 1 ];
     }
     elsif ( %data ) {
-        if ( $data{status} && $data{status} eq 'deleted' && ! grep { $_ ne 'id' && $_ ne 'status' } keys %data ) {
+        if ( $data{status} && lc $data{status} eq 'deleted' && ! grep { $_ ne 'id' && $_ ne 'status' } keys %data ) {
             if ( !$ticket->CurrentUserHasRight('DeleteTicket') ) {
                 return [ "# You are not allowed to delete ticket $id.", [], {}, 1 ];
             }
diff --git a/share/html/Ticket/Elements/Reminders b/share/html/Ticket/Elements/Reminders
index 37b360b..8ed870e 100644
--- a/share/html/Ticket/Elements/Reminders
+++ b/share/html/Ticket/Elements/Reminders
@@ -112,11 +112,11 @@ my $visible = 0;
 % }
 % }
 
-% if ($Ticket->Status ne "deleted") {
+% if (lc $Ticket->Status ne "deleted") {
 <&|/l&>New reminder:</&>
 <& SELF:NewReminder, Ticket => $Ticket &>
 % }
-% return($Ticket->Status ne "deleted" or $visible);
+% return(lc $Ticket->Status ne "deleted" or $visible);
 <%method NewReminder>
 <%args>
 $Ticket

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


More information about the Rt-commit mailing list