[Rt-commit] rt branch, 4.2/queue-summary-cache, updated. rt-4.2.13-123-g5b00347

Jim Brandt jbrandt at bestpractical.com
Mon Apr 10 16:22:14 EDT 2017


The branch, 4.2/queue-summary-cache has been updated
       via  5b00347e1526b6e782f5cbd811378bc043bc5047 (commit)
      from  40a543773eadda64fc16393b2566e5c4bc0092cb (commit)

Summary of changes:
 lib/RT/Queue.pm                     |  2 +-
 share/html/Elements/MyAdminQueues   | 10 +++++++++-
 share/html/Elements/MySupportQueues | 22 +++++++++++++++++++++-
 3 files changed, 31 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 5b00347e1526b6e782f5cbd811378bc043bc5047
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Mon Apr 10 16:21:54 2017 -0400

    Update other portlets using SummaryByStatus

diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index c149238..b3a282e 100644
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -90,7 +90,7 @@ RT::ACE->RegisterCacheHandler(sub {
     );
 
     return unless $args{Action}    =~ /^(Grant|Revoke)$/i
-              and $args{RightName} =~ /^(SeeQueue|CreateTicket)$/;
+              and $args{RightName} =~ /^(SeeQueue|CreateTicket|AdminQueue)$/;
 
     RT->System->QueueCacheNeedsUpdate(1);
 });
diff --git a/share/html/Elements/MyAdminQueues b/share/html/Elements/MyAdminQueues
index 7147cf0..8754425 100644
--- a/share/html/Elements/MyAdminQueues
+++ b/share/html/Elements/MyAdminQueues
@@ -47,6 +47,14 @@
 %# END BPS TAGGED BLOCK }}}
 <&|/Widgets/TitleBox, title => loc("Queues I administer"), bodyclass => "" &>
 <& /Elements/QueueSummaryByStatus,
-   queue_filter => sub { $_->CurrentUserHasRight('AdminQueue') },
+   queues => $session{$cache_key}{objects},
 &>
 </&>
+<%INIT>
+my $cache_key = SetObjectSessionCache(
+    ObjectType => 'RT::Queue',
+    CheckRight => 'AdminQueue',
+    ShowAll => 0,
+    CacheNeedsUpdate => RT->System->QueueCacheNeedsUpdate,
+);
+</%INIT>
diff --git a/share/html/Elements/MySupportQueues b/share/html/Elements/MySupportQueues
index 6fb5054..177745b 100644
--- a/share/html/Elements/MySupportQueues
+++ b/share/html/Elements/MySupportQueues
@@ -47,6 +47,26 @@
 %# END BPS TAGGED BLOCK }}}
 <&|/Widgets/TitleBox, title => loc("Queues I'm an AdminCc for"), bodyclass => "" &>
 <& /Elements/QueueSummaryByStatus,
-   queue_filter => sub { $_->IsAdminCc($session{'CurrentUser'}->Id) },
+    queues => \@queues,
 &>
 </&>
+<%INIT>
+my $Queues = RT::Queues->new( $session{'CurrentUser'} );
+$Queues->UnLimit();
+$m->callback( CallbackName => 'SQLFilter', Queues => $Queues );
+
+my @queues;
+foreach my $queue ( @{ $Queues->ItemsArrayRef } ){
+    next unless $queue->IsAdminCc($session{'CurrentUser'}->Id);
+
+    if ( $queue->Id ) {
+        push @queues, {
+            Id          => $queue->Id,
+            Name        => $queue->Name,
+            Description => $queue->_Accessible("Description" => "read") ? $queue->Description : undef,
+            Lifecycle   => $queue->_Accessible("Lifecycle" => "read") ? $queue->Lifecycle : undef,
+        };
+    }
+}
+
+</%INIT>

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


More information about the rt-commit mailing list