[Rt-commit] rt branch, 4.4/use-status-active, created. rt-4.4.0-57-gd84afa6

Shawn Moore shawn at bestpractical.com
Wed Feb 17 01:47:25 EST 2016


The branch, 4.4/use-status-active has been created
        at  d84afa6f43c283a1452bf1cb22bdc38cb20b8c37 (commit)

- Log -----------------------------------------------------------------
commit 41a3ff6744a07fa45f61f299b8f5be198a04bc3a
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:35:13 2016 +0000

    Fix variable name in ShowQueue
    
        Label is what we display to the user; value is what we use internally

diff --git a/share/html/Ticket/Elements/ShowQueue b/share/html/Ticket/Elements/ShowQueue
index 1e4b444..5b14cb5 100644
--- a/share/html/Ticket/Elements/ShowQueue
+++ b/share/html/Ticket/Elements/ShowQueue
@@ -46,22 +46,22 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 % if ( $query ) {
-<a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $query |u,n %>"><% $value %></a>
+<a href="<% RT->Config->Get('WebPath') %>/Search/Results.html?Query=<% $query |u,n %>"><% $label %></a>
 % } else {
-<% $value %>
+<% $label %>
 % }
 <%ARGS>
 $Ticket => undef
 $QueueObj
 </%ARGS>
 <%INIT>
-my $value = $QueueObj->Name;
+my $label = $QueueObj->Name;
 my $query;
 
 if ( $Ticket and $Ticket->CurrentUserHasRight('SeeQueue') ) {
     # Grab the queue name anyway if the current user can
     # see the queue based on his role for this ticket
-    $value = $QueueObj->__Value('Name');
+    $label = $QueueObj->__Value('Name');
     if ( $session{CurrentUser}->Privileged ) {
         my @statuses = $QueueObj->ActiveStatusArray();
         s{(['\\])}{\\$1}g for @statuses;
@@ -69,6 +69,6 @@ if ( $Ticket and $Ticket->CurrentUserHasRight('SeeQueue') ) {
     }
 }
 
-$value = '#'. $QueueObj->id
-    unless defined $value && length $value;
+$label = '#'. $QueueObj->id
+    unless defined $label && length $label;
 </%INIT>

commit b583a58e17e9dd9871b36c0b1dc29d768b982e2b
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:36:46 2016 +0000

    Use Status = '__Active__' for ShowQueue
    
    Fixes: I#31696

diff --git a/share/html/Ticket/Elements/ShowQueue b/share/html/Ticket/Elements/ShowQueue
index 5b14cb5..baa1250 100644
--- a/share/html/Ticket/Elements/ShowQueue
+++ b/share/html/Ticket/Elements/ShowQueue
@@ -63,9 +63,7 @@ if ( $Ticket and $Ticket->CurrentUserHasRight('SeeQueue') ) {
     # see the queue based on his role for this ticket
     $label = $QueueObj->__Value('Name');
     if ( $session{CurrentUser}->Privileged ) {
-        my @statuses = $QueueObj->ActiveStatusArray();
-        s{(['\\])}{\\$1}g for @statuses;
-        $query = "Queue = " . $QueueObj->id . " AND ( ". join(" OR ", map {"Status = '$_'"} @statuses) . " )";
+        $query = "Queue = " . $QueueObj->id . " AND Status = '__Active__'";
     }
 }
 

commit 458b250261b6147e14cd194b9b5ace3c38d57826
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:40:49 2016 +0000

    Use queue name rather than queue id in ShowQueue search link
    
        This is the same escaping code we've long since used in
        the QueueList. Using the queue by ID in a search is very
        surprising and not at all self-documenting.

diff --git a/share/html/Ticket/Elements/ShowQueue b/share/html/Ticket/Elements/ShowQueue
index baa1250..f15acfe 100644
--- a/share/html/Ticket/Elements/ShowQueue
+++ b/share/html/Ticket/Elements/ShowQueue
@@ -63,7 +63,9 @@ if ( $Ticket and $Ticket->CurrentUserHasRight('SeeQueue') ) {
     # see the queue based on his role for this ticket
     $label = $QueueObj->__Value('Name');
     if ( $session{CurrentUser}->Privileged ) {
-        $query = "Queue = " . $QueueObj->id . " AND Status = '__Active__'";
+        my $queue_name_parameter = $label;
+        $queue_name_parameter =~ s/(['\\])/\\$1/g; #'
+        $query = "Queue = '$queue_name_parameter' AND Status = '__Active__'";
     }
 }
 

commit f8f532700f9e05bca854f9ad44a5348654621035
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:47:20 2016 +0000

    Use Status = '__Active__' for queuelist links
    
    Fixes: I#31695

diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
index 04953db..4bc1d24 100644
--- a/share/html/Elements/QueueSummaryByLifecycle
+++ b/share/html/Elements/QueueSummaryByLifecycle
@@ -70,7 +70,7 @@ for my $queue (@queues) {
 <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
 
 <td>
-    <a href="<% $link_all->($queue, \@cur_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
+    <a href="<% $link_all->($queue) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
 </td>
 
 %   for my $status (@cur_statuses) {
@@ -93,10 +93,8 @@ my $build_search_link = sub {
 };
 
 my $link_all = sub {
-    my ($queue, $all_statuses) = @_;
-    my @escaped = @{$all_statuses};
-    s{(['\\])}{\\$1}g for @escaped;
-    return $build_search_link->($queue->{Name}, "(".join(" OR ", map "Status = '$_'", @escaped).")");
+    my ($queue) = @_;
+    return $build_search_link->($queue->{Name}, "Status = '__Active__'");
 };
 
 my $link_status = sub {
diff --git a/share/html/Elements/QueueSummaryByStatus b/share/html/Elements/QueueSummaryByStatus
index f9ec66c..bbb4c76 100644
--- a/share/html/Elements/QueueSummaryByStatus
+++ b/share/html/Elements/QueueSummaryByStatus
@@ -59,12 +59,11 @@ my $i = 0;
 for my $queue (@queues) {
     $i++;
     my $lifecycle = $lifecycle{ lc $queue->{'Lifecycle'} };
-    my @queue_statuses = grep { $lifecycle->IsValid($_) } @statuses;
 </%PERL>
 <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
 
 <td>
-    <a href="<% $link_all->($queue, \@queue_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
+    <a href="<% $link_all->($queue) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
 </td>
 
 <%perl>
@@ -92,8 +91,8 @@ my $build_search_link = sub {
 };
 
 my $link_all = sub {
-    my ($queue, $all_statuses) = @_;
-    return $build_search_link->($queue->{Name}, "(".join(" OR ", map "Status = '$_'", @$all_statuses).")");
+    my ($queue) = @_;
+    return $build_search_link->($queue->{Name}, "Status = '__Active__'");
 };
 
 my $link_status = sub {

commit f2672473226be825941b016bdfe9906963852e17
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:51:14 2016 +0000

    This syntax highlighting hint is no longer relevant
    
        This belongs on the line with the escaping regular expression,
        which was moved in d48afa23. It went unnoticed presumably because
        emacs colors leaning toothpicks more correctly than vim.

diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
index 4bc1d24..420ccd6 100644
--- a/share/html/Elements/QueueSummaryByLifecycle
+++ b/share/html/Elements/QueueSummaryByLifecycle
@@ -150,7 +150,7 @@ my @escaped = @statuses;
 s{(['\\])}{\\$1}g for @escaped;
 my $query =
     "(".
-    join(" OR ", map {"Status = '$_'"} @escaped) #'
+    join(" OR ", map {"Status = '$_'"} @escaped)
     .") AND (".
     join(' OR ', map "Queue = ".$_->{id}, @queues)
     .")";

commit ebd3a988d3bcfb43246a0699a58759ae7066577e
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 05:54:02 2016 +0000

    Use Status = '__Active__' for queuelist report query
    
        Passing statuses _was_ supported but is used by neither core nor RTIR
        (which ships its own QueueSummary template)
    
        Along the way, ByLifecycle received a bugfix, d48afa23, which
        ByStatus did not. This commit obsoletes that bugfix, restoring some
        parity between these two templates.

diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
index 420ccd6..a768412 100644
--- a/share/html/Elements/QueueSummaryByLifecycle
+++ b/share/html/Elements/QueueSummaryByLifecycle
@@ -132,12 +132,11 @@ for my $queue (@queues) {
     $lifecycle{ lc $cycle->Name } = $cycle;
 }
 
-unless (@statuses) {
-    my %seen;
-    foreach my $set ( 'initial', 'active' ) {
-        foreach my $lifecycle ( map $lifecycle{$_}, sort keys %lifecycle ) {
-            push @statuses, grep !$seen{ lc $_ }++, $lifecycle->Valid($set);
-        }
+my @statuses;
+my %seen;
+foreach my $set ( 'initial', 'active' ) {
+    foreach my $lifecycle ( map $lifecycle{$_}, sort keys %lifecycle ) {
+        push @statuses, grep !$seen{ lc $_ }++, $lifecycle->Valid($set);
     }
 }
 
@@ -146,12 +145,8 @@ my $statuses = {};
 
 use RT::Report::Tickets;
 my $report = RT::Report::Tickets->new( RT->SystemUser );
-my @escaped = @statuses;
-s{(['\\])}{\\$1}g for @escaped;
 my $query =
-    "(".
-    join(" OR ", map {"Status = '$_'"} @escaped)
-    .") AND (".
+    "(Status = '__Active__') AND (".
     join(' OR ', map "Queue = ".$_->{id}, @queues)
     .")";
 $query = 'id < 0' unless @queues;
@@ -165,5 +160,4 @@ while ( my $entry = $report->Next ) {
 </%INIT>
 <%ARGS>
 $queue_filter => undef
- at statuses => ()
 </%ARGS>
diff --git a/share/html/Elements/QueueSummaryByStatus b/share/html/Elements/QueueSummaryByStatus
index bbb4c76..812ba4b 100644
--- a/share/html/Elements/QueueSummaryByStatus
+++ b/share/html/Elements/QueueSummaryByStatus
@@ -129,12 +129,11 @@ for my $queue (@queues) {
     $lifecycle{ lc $cycle->Name } = $cycle;
 }
 
-unless (@statuses) {
-    my %seen;
-    foreach my $set ( 'initial', 'active' ) {
-        foreach my $lifecycle ( map $lifecycle{$_}, sort keys %lifecycle ) {
-            push @statuses, grep !$seen{ lc $_ }++, $lifecycle->Valid($set);
-        }
+my @statuses;
+my %seen;
+foreach my $set ( 'initial', 'active' ) {
+    foreach my $lifecycle ( map $lifecycle{$_}, sort keys %lifecycle ) {
+        push @statuses, grep !$seen{ lc $_ }++, $lifecycle->Valid($set);
     }
 }
 
@@ -144,9 +143,7 @@ my $statuses = {};
 use RT::Report::Tickets;
 my $report = RT::Report::Tickets->new( RT->SystemUser );
 my $query =
-    "(".
-    join(" OR ", map {s{(['\\])}{\\$1}g; "Status = '$_'"} @statuses) #'
-    .") AND (".
+    "(Status = '__Active__') AND (".
     join(' OR ', map "Queue = ".$_->{id}, @queues)
     .")";
 $query = 'id < 0' unless @queues;
@@ -160,5 +157,4 @@ while ( my $entry = $report->Next ) {
 </%INIT>
 <%ARGS>
 $queue_filter => undef
- at statuses => ()
 </%ARGS>

commit d25538922cdd9d1d2f93411b0a85b54fdd7e361e
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:15:18 2016 +0000

    Use Status = '__Active__' for ExtendedStatus dependency search link

diff --git a/share/html/Elements/RT__Ticket/ColumnMap b/share/html/Elements/RT__Ticket/ColumnMap
index d695ba3..33e32ed 100644
--- a/share/html/Elements/RT__Ticket/ColumnMap
+++ b/share/html/Elements/RT__Ticket/ColumnMap
@@ -132,9 +132,7 @@ $COLUMN_MAP = {
                     return \'<em>', loc('(pending approval)'), \'</em>';
                 }
                 else {
-                    my $Query = "DependedOnBy = " . $Ticket->id;
-                    $Query .= " AND (" . join(" OR ", map { "Status = '$_'" } RT::Queue->ActiveStatusArray) . ")";
-
+                    my $Query = "DependedOnBy = " . $Ticket->id . " AND Status = '__Active__'";
                     my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
 
                     if ($count == 1) {

commit d254b91706db3c5c2d7378084fa733f2c5325b1b
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:20:42 2016 +0000

    Use Status = '__Active__' for Assets->Ticket search

diff --git a/share/html/Elements/RT__Asset/ColumnMap b/share/html/Elements/RT__Asset/ColumnMap
index ecf6993..618501d 100644
--- a/share/html/Elements/RT__Asset/ColumnMap
+++ b/share/html/Elements/RT__Asset/ColumnMap
@@ -97,8 +97,7 @@ my $COLUMN_MAP = {
         title     => 'Active tickets', # loc
         value     => sub {
             my $Asset = shift;
-            my $Query = "RefersTo = 'asset:" . $Asset->id . "'";
-            $Query .= " AND (" . join(" OR ", map { "Status = '$_'" } RT::Queue->ActiveStatusArray) . ")";
+            my $Query = "RefersTo = 'asset:" . $Asset->id . "' AND Status = '__Active__'";
             my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
             return \'[ <a href="',$SearchURL,\'">Active</a> ]';
         }
@@ -107,8 +106,7 @@ my $COLUMN_MAP = {
         title     => 'Inactive tickets', # loc
         value     => sub {
             my $Asset = shift;
-            my $Query = "RefersTo = 'asset:" . $Asset->id . "'";
-            $Query .= " AND (" . join(" OR ", map { "Status = '$_'" } RT::Queue->InactiveStatusArray) . ")";
+            my $Query = "RefersTo = 'asset:" . $Asset->id . "' AND Status = '__Inactive__'";
             my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
             return \'[ <a href="',$SearchURL,\'">Inactive</a> ]';
         }

commit a2a6e9c1e1fa148212cdaddcee536778b372b365
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:25:59 2016 +0000

    Use Status = '__Active__' for simple search status:active

diff --git a/lib/RT/Search/Simple.pm b/lib/RT/Search/Simple.pm
index ac7b226..6fad6be 100644
--- a/lib/RT/Search/Simple.pm
+++ b/lib/RT/Search/Simple.pm
@@ -256,9 +256,9 @@ sub HandleContent   { return content   => "Content LIKE '$_[1]'"; }
 sub HandleId        { $_[1] =~ s/^#//; return id => "Id = $_[1]"; }
 sub HandleStatus    {
     if ($_[1] =~ /^active$/i and !$_[2]) {
-        return status => map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->ActiveStatusArray();
+        return status => "Status = '__Active__'";
     } elsif ($_[1] =~ /^inactive$/i and !$_[2]) {
-        return status => map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->InactiveStatusArray();
+        return status => "Status = '__Inactive__'";
     } elsif ($_[1] =~ /^any$/i and !$_[2]) {
         return 'status';
     } else {

commit efa9852e5b76025a56d4e653bf47e259db0994b0
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:26:22 2016 +0000

    Use Status = '__Active__' for OnlySearchActiveTicketsInSimpleSearch

diff --git a/lib/RT/Search/Simple.pm b/lib/RT/Search/Simple.pm
index 6fad6be..ac44252 100644
--- a/lib/RT/Search/Simple.pm
+++ b/lib/RT/Search/Simple.pm
@@ -188,7 +188,7 @@ sub Finalize {
     # limits ourselves, and we're not limited by id
     if (not $limits->{status} and not $limits->{id}
         and RT::Config->Get('OnlySearchActiveTicketsInSimpleSearch', $self->TicketsObj->CurrentUser)) {
-        $limits->{status} = [map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->ActiveStatusArray()];
+        $limits->{status} = ["Status = '__Active__'"];
     }
 
     # Respect the "only search these queues" limit if we didn't

commit eb3a9c5cf478d89dba1317fb0e0817ac71f45e7b
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:29:56 2016 +0000

    Use Status = '__Active__' for self service queries

diff --git a/share/html/SelfService/Closed.html b/share/html/SelfService/Closed.html
index fdce958..822733a 100644
--- a/share/html/SelfService/Closed.html
+++ b/share/html/SelfService/Closed.html
@@ -49,7 +49,7 @@
 
 <& /SelfService/Elements/MyRequests,
     %ARGS,
-    status          => [ RT::Queue->InactiveStatusArray ],
+    status          => '__Inactive__',
     title           => loc('My closed tickets'),
     BaseURL         => RT->Config->Get('WebPath') ."/SelfService/Closed.html?",
     Page            => $Page,
diff --git a/share/html/SelfService/Elements/MyRequests b/share/html/SelfService/Elements/MyRequests
index d0b04c3..8348dc9 100644
--- a/share/html/SelfService/Elements/MyRequests
+++ b/share/html/SelfService/Elements/MyRequests
@@ -62,16 +62,13 @@
 $title ||= loc("My [_1] tickets", $friendly_status);
 my $id = $session{'CurrentUser'}->id;
 my $Query = "( Watcher.id = $id )";
-if ( @status ) {
-    @status = map {s/(['\\])/\\$1/g; "Status = '$_'"} @status;
-    $Query .= " AND ( " . join(' OR ', @status ) . " )";
-}
+$Query .= " AND Status = '$status'" if $status;
 my $Format = RT->Config->Get('DefaultSelfServiceSearchResultFormat');
 </%INIT>
 <%ARGS>
 $title => undef
 $friendly_status => loc('open')
- at status => ()
+$status => undef
 $BaseURL => undef
 $Page => 1
 @Order => ('ASC')
diff --git a/share/html/SelfService/index.html b/share/html/SelfService/index.html
index c5aad9f..6f3251d 100644
--- a/share/html/SelfService/index.html
+++ b/share/html/SelfService/index.html
@@ -48,7 +48,7 @@
 <& /SelfService/Elements/Header, Title => loc('Open tickets') &>
 <& /SelfService/Elements/MyRequests,
     %ARGS,
-    status          => [ RT::Queue->ActiveStatusArray() ],
+    status  => '__Active__',
     title   => loc('My open tickets'),
     BaseURL => RT->Config->Get('WebPath') ."/SelfService/?",
     Page    => $Page, 

commit 44ad7357adc4123dcfc144cbb9c17469065ab581
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:31:49 2016 +0000

    Use Status = '__Active__' for requestor ticket lists
    
        The condition's "name" is unused.

diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsActive b/share/html/Ticket/Elements/ShowRequestorTicketsActive
index 3d945bc..99adba1 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsActive
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsActive
@@ -48,9 +48,7 @@
 <& ShowRequestorTickets, %ARGS, Description => loc('active'), conditions => $conditions, Rows => $Rows  &>
 <%INIT>
 unless ( @$conditions ) {
-    foreach (RT::Queue->ActiveStatusArray()) {
-        push @$conditions, { cond => "Status = '$_'", name => loc($_) };
-    }
+    push @$conditions, { cond => "Status = '__Active__'" };
 }
 </%INIT>
 <%ARGS>
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsInactive b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
index eb08c4c..fa8e6df 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsInactive
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
@@ -48,9 +48,7 @@
 <& ShowRequestorTickets, %ARGS, Description => loc('inactive'), conditions => $conditions, Rows => $Rows &>
 <%INIT>
 unless ( @$conditions ) {
-    foreach (RT::Queue->InactiveStatusArray()) {
-        push @$conditions, { cond => "Status = '$_'", name => loc($_) };
-    }
+    push @$conditions, { cond => "Status = '__Inactive__'" };
 }
 </%INIT>
 <%ARGS>

commit d84afa6f43c283a1452bf1cb22bdc38cb20b8c37
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Feb 17 06:35:24 2016 +0000

    Use Status = '__Active__' for user ticket portlets
    
        The condition's "name" is unused.

diff --git a/share/html/User/Elements/Portlets/ActiveTickets b/share/html/User/Elements/Portlets/ActiveTickets
index 8ed8c58..665ae7d 100644
--- a/share/html/User/Elements/Portlets/ActiveTickets
+++ b/share/html/User/Elements/Portlets/ActiveTickets
@@ -58,9 +58,7 @@
 &>
 <%INIT>
 unless ( @$conditions ) {
-    foreach (RT::Queue->ActiveStatusArray()) {
-        push @$conditions, { cond => "Status = '$_'", name => loc($_) };
-    }
+    push @$conditions, { cond => "Status = '__Active__'" };
 }
 </%INIT>
 <%ARGS>
diff --git a/share/html/User/Elements/Portlets/InactiveTickets b/share/html/User/Elements/Portlets/InactiveTickets
index a768427..7507fe0 100644
--- a/share/html/User/Elements/Portlets/InactiveTickets
+++ b/share/html/User/Elements/Portlets/InactiveTickets
@@ -58,9 +58,7 @@
 &>
 <%INIT>
 unless ( @$conditions ) {
-    foreach (RT::Queue->InactiveStatusArray()) {
-        push @$conditions, { cond => "Status = '$_'", name => loc($_) };
-    }
+    push @$conditions, { cond => "Status = '__Inactive__'" };
 }
 </%INIT>
 <%ARGS>

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


More information about the rt-commit mailing list