[Rt-commit] rtir branch, 2.9/update-disable-blocks-config, created. 3.0.0rc1-51-gca7f15a

Jim Brandt jbrandt at bestpractical.com
Fri Apr 19 17:17:53 EDT 2013


The branch, 2.9/update-disable-blocks-config has been created
        at  ca7f15aeeb038dbd372733c041d634c8b4ee1437 (commit)

- Log -----------------------------------------------------------------
commit ca7f15aeeb038dbd372733c041d634c8b4ee1437
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Apr 19 17:13:52 2013 -0400

    Disable Blocks features based on status of Blocks queue
    
    Previously a config option was used to turn off Blocks
    functionality, but you also needed to disable the Blocks queue
    to remove it from other places queues appear. Update to use the
    status of the Blocks queue as the indication to disable Blocks
    features and update docs appropriately.

diff --git a/CHANGES b/CHANGES
index c935643..953d1c2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -28,6 +28,10 @@ CHANGES IN 3.0.0
 * RTIR's SLA implementation have been dropped in favor
   of RT::Extension::SLA.
 
+* The $RTIR_DisableBlocksQueue configuration option has been
+  deprecated. To turn off Blocks features, just disable the queue
+  in RT and all Blocks features will be hidden.
+
 * Numerouse bug fixes.
 
 CHANGES IN 2.6.1
diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index f035ba1..c987014 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -550,11 +550,12 @@ Set( $_RTIR_Constituency_Propagation,    'no' );
 
 =item C<$RTIR_DisableBlocksQueue>
 
-If true then Blocks queue functionality inactive and disabled.
-
-=cut
-
-Set($RTIR_DisableBlocksQueue, 0);
+In RTIR before version 3.0, this option was used to hide or disable some of
+the functionality of the Blocks queue for users who didn't need
+it. However, the queue itself was still present and active, and would
+appear in places like the "New Ticket In" dropdown. You can now disable
+the Blocks features by disabling the Blocks queue. See
+L<RT::IR::AdministrationTutorial/"Blocks Queue"> for details.
 
 =item C<$RTIR_BlockAproveActionRegexp>
 
diff --git a/html/Callbacks/RTIR/Elements/MakeClicky/Default b/html/Callbacks/RTIR/Elements/MakeClicky/Default
index 27f7679..527f40b 100644
--- a/html/Callbacks/RTIR/Elements/MakeClicky/Default
+++ b/html/Callbacks/RTIR/Elements/MakeClicky/Default
@@ -37,7 +37,7 @@ my %actions;
         $args{host} ||= $args{value};
         my $result .= qq{[<a href="$web_path/RTIR/Tools/Lookup.html?$args{lookup_params}type=ip&q=$args{host}">}
                       .loc('lookup IP') .q{</a>]};
-        if ( $args{incident} && !RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+        if ( $args{incident} && !RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'}) ) {
             $result .= qq{[<a href="$web_path/RTIR/Create.html?Incident=$args{incident}&Queue=Blocks&IP-Value=$args{host}">block</a>]};
         }
         if ( $args{'ticket'} && $args{'ticket'}->id ) {
diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index ff8b936..61fc163 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -57,7 +57,7 @@ $root->child(
     create => title => loc('Create'),
     path => '/RTIR/Create.html?Queue=Investigations',
 );
-unless ( RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+unless ( RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'}) ) {
     $root->child(
         blocks => title => loc('Blocks'),
         path => '/RTIR/Search/Results.html?Queue=Blocks'
diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 83658dc..bfac7b5 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -312,8 +312,8 @@ $QueueObj->Load( $Queue ) || Abort( loc("Queue could not be loaded.") );
 
 
 my $Type = RT::IR::TicketType( Queue => $Queue );
-if ($Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
-    Abort(loc("Blocks queue is disabled via config file"));
+if ($Type eq 'Block' && RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'}) ) {
+    Abort(loc("Blocks queue is currently disabled"));
 }
 if ( $m->comp_exists("/RTIR/$Type/Create.html") ) {
     return $m->comp( "/RTIR/$Type/Create.html", %ARGS );
diff --git a/html/RTIR/Display.html b/html/RTIR/Display.html
index 38b1db6..2c97e6c 100644
--- a/html/RTIR/Display.html
+++ b/html/RTIR/Display.html
@@ -129,8 +129,8 @@ unless ( $id eq 'new' ) {
 my $Type = RT::IR::TicketType( Queue => $QueueObj );
 return $m->comp( '/Ticket/Display.html', %ARGS ) unless $Type;
 
-if ($Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
-    Abort(loc("Blocks queue is disabled via config file"));
+if ($Type eq 'Block' && RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'}) ) {
+    Abort(loc("Blocks queue is currently disabled"));
 }
 if ( $m->comp_exists("/RTIR/$Type/Display.html") ) {
     return $m->comp("/RTIR/$Type/Display.html", %ARGS);
diff --git a/html/RTIR/Edit.html b/html/RTIR/Edit.html
index d8fb170..d7c18a7 100644
--- a/html/RTIR/Edit.html
+++ b/html/RTIR/Edit.html
@@ -141,8 +141,8 @@ $m->callback(CallbackName => 'Initial', %ARGS, Ticket => $Ticket);
 my $Type = RT::IR::TicketType( Ticket => $Ticket );
 
 return $m->comp( '/Ticket/Display.html', %ARGS ) unless $Type;
-if( $Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
-    Abort(loc("Blocks queue is disabled via config file"));
+if( $Type eq 'Block' && RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'}) ) {
+    Abort(loc("Blocks queue is currently disabled"));
 }
 if ( $m->comp_exists("/RTIR/$Type/Edit.html") ) {
     return $m->comp("/RTIR/$Type/Edit.html", %ARGS);
diff --git a/html/RTIR/Incident/Elements/ShowChildren b/html/RTIR/Incident/Elements/ShowChildren
index fb5d545..d43f7b3 100644
--- a/html/RTIR/Incident/Elements/ShowChildren
+++ b/html/RTIR/Incident/Elements/ShowChildren
@@ -32,7 +32,7 @@ $OrderBy => 'Due'
 $Rows  => 8
 </%ARGS>
 <%INIT>
-return if $Queue eq 'Blocks' && RT->Config->Get('RTIR_DisableBlocksQueue');
+return if $Queue eq 'Blocks' && RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'});
 
 my $id = $IncidentObj->id;
 my $EscapedQueue = $m->interp->apply_escapes( $Queue, 'u' );
diff --git a/html/RTIR/Incident/Reply/Refine.html b/html/RTIR/Incident/Reply/Refine.html
index 5d06776..eab5ab3 100644
--- a/html/RTIR/Incident/Reply/Refine.html
+++ b/html/RTIR/Incident/Reply/Refine.html
@@ -1,7 +1,7 @@
 <%INIT>
 my @queues = ('Incident Reports');
 push @queues, 'Investigations' if $ARGS{'All'};
-push @queues, 'Blocks' if $ARGS{'All'} && !RT->Config->Get('RTIR_DisableBlocksQueue');
+push @queues, 'Blocks' if $ARGS{'All'} && !RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'});
 
 return $m->comp(
     '/RTIR/Search/Elements/RefinePage',
diff --git a/html/RTIR/Incident/Reply/index.html b/html/RTIR/Incident/Reply/index.html
index 70e4011..cd8aadb 100644
--- a/html/RTIR/Incident/Reply/index.html
+++ b/html/RTIR/Incident/Reply/index.html
@@ -63,7 +63,7 @@
     OrderBy       => $OrderBy,
     Order         => $Order,
 &>
-% unless( RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+% unless( RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'}) ) {
 <h2><&|/l&>Blocks Correspondents</&></h2>
 <& /RTIR/Search/Elements/ShowResults,
     Queue         => 'Investigations',
@@ -203,7 +203,7 @@ if ($Status eq 'resolved') {
 
 my @queues = ('Incident Reports');
 push @queues, 'Investigations' if $All;
-push @queues, 'Blocks' unless RT->Config->Get('RTIR_DisableBlocksQueue');
+push @queues, 'Blocks' unless RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'});
 
 $Query ||= RT::IR->ActiveQuery( Queue => \@queues );
 
diff --git a/html/RTIR/Tools/Elements/LookupRelatedTickets b/html/RTIR/Tools/Elements/LookupRelatedTickets
index 99e0aa1..63fce89 100644
--- a/html/RTIR/Tools/Elements/LookupRelatedTickets
+++ b/html/RTIR/Tools/Elements/LookupRelatedTickets
@@ -13,7 +13,7 @@
 
 </td><td width="50%" valign="top">
 
-% unless ( RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+% unless ( RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'}) ) {
 <& LookupSummary, %ARGS, Queue => 'Blocks', Query => $query &>
 % }
 
diff --git a/html/RTIR/Tools/Elements/LookupSummary b/html/RTIR/Tools/Elements/LookupSummary
index 444c843..a806d49 100644
--- a/html/RTIR/Tools/Elements/LookupSummary
+++ b/html/RTIR/Tools/Elements/LookupSummary
@@ -90,7 +90,7 @@ if ( $TicketObj && RT::IR::TicketType( Ticket => $TicketObj ) eq 'Incident'
                 Requestors => $q,
             ),
         };
-    } elsif ( $Queue eq 'Blocks' && $LookupType eq 'ip' && !RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+    } elsif ( $Queue eq 'Blocks' && $LookupType eq 'ip' && !RT::IR->BlocksQueueIsDisabled($session{'CurrentUser'}) ) {
         push @box_actions, {
             title => loc('Create'),
             path => "/RTIR/Create.html?". $m->comp('/Elements/QueryString',
diff --git a/lib/RT/Action/RTIR_ResolveChildren.pm b/lib/RT/Action/RTIR_ResolveChildren.pm
index 2758d2e..714c17c 100644
--- a/lib/RT/Action/RTIR_ResolveChildren.pm
+++ b/lib/RT/Action/RTIR_ResolveChildren.pm
@@ -77,7 +77,7 @@ sub Commit {
     my $id = $incident->Id;
 
     foreach my $qname ( 'Incident Reports', 'Investigations', 'Blocks' ) {
-        next if $qname eq 'Blocks' && RT->Config->Get('RTIR_DisableBlocksQueue');
+        next if $qname eq 'Blocks' && RT::IR->BlocksQueueIsDisabled($incident->CurrentUser);
 
         my $members = RT::IR->IncidentChildren(
             $incident, Queue => $qname,
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index f48c9b2..012cde4 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -398,10 +398,22 @@ sub IsLinkedToActiveIncidents {
     return $tickets->Count;
 }
 
-sub MapStatus {
+=head2 BlockQueueIsDisabled
+
+Returns true if the Blocks queue is disabled.
+
+=cut
+
+sub BlocksQueueIsDisabled {
     my $self = shift;
-    my ($status, $from, $to) = @_;
-    return unless $status;
+    my $CurrentUser = shift;
+
+    my $blocks_queue = RT::Queue->new($CurrentUser);
+    $blocks_queue->Load('Blocks');
+    return $blocks_queue->Disabled;
+}
+
+sub MapStatus { my $self = shift; my ($status, $from, $to) = @_; return unless $status;
 
     foreach my $e ($from, $to) {
         if ( blessed $e ) {
diff --git a/lib/RT/IR/AdministrationTutorial.pod b/lib/RT/IR/AdministrationTutorial.pod
index 79b2e52..40c8016 100644
--- a/lib/RT/IR/AdministrationTutorial.pod
+++ b/lib/RT/IR/AdministrationTutorial.pod
@@ -16,14 +16,11 @@ your custom configuration values there.
 
 =head2 Blocks Queue
 
-You may disable the Blocks queue by putting the following into your
-RT_SiteConfig.pm config:
-
-    Set($RTIR_DisableBlocksQueue, 1);
-
-You will probably also want to disable the Queue using the RT
-Administrative interface.  Tools -> Configuration -> Queues -> Blocks,
-uncheck Enabled and click Save Changes.
+If the Blocks functionality doesn't fit your workflow, you can disable
+it by disabling the Blocks queue in RT. Log in as an admin and go to
+Tools -> Configuration -> Queues -> Blocks, uncheck Enabled and click Save Changes.
+This will also hide all references to the Blocks features in the RTIR
+interface.
 
 =head2 Status
 

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


More information about the Rt-commit mailing list