[Rt-commit] r5334 - in rtir/branches/1.9-EXPERIMENTAL: etc lib/RT/Action

ruz at bestpractical.com ruz at bestpractical.com
Sat Jun 3 21:16:37 EDT 2006


Author: ruz
Date: Sat Jun  3 21:16:36 2006
New Revision: 5334

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm
   rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetBlockState.pm

Log:
 r1458 at cubic-pc:  cubic | 2006-06-04 05:26:42 +0400
 * new config option $RTIR_BlockAproveActionRegexp


Modified: rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm	Sat Jun  3 21:16:36 2006
@@ -276,6 +276,11 @@
 # if true then Blocks queue functionality inactive and disabled
 Set($RTIR_DisableBlocksQueue, 0);
 
+# When requestor replies on the block in pending state RTIR
+# changes state, you can set regular expresion so state would
+# be changed only when it matches
+Set($RTIR_BlockAproveActionRegexp, undef);
+
 # Define list of enabled MakeClicky extensions; RTIR extends the
 # default 'httpurl', and additionally provides 'ip', 'ipdecimal',
 # 'email', 'domain' and 'RIPE'.  It is possible to add your own types

Modified: rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetBlockState.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetBlockState.pm	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetBlockState.pm	Sat Jun  3 21:16:36 2006
@@ -86,17 +86,22 @@
             return 'active';
         }
     }
-    if ( $old_state eq 'pending activation' ) {
 
+    # next code related to requestor's correspondents
+    return '' unless $txn->Type eq 'Correspond';
+    return '' unless $t->Requestors->HasMember( $txn->CreatorObj->PrincipalObj );
+
+    if ( my $re = RT->Config->Get('RTIR_BlockAproveActionRegexp') ) {
+        my $content = $txn->Content;
+        return '' if !$content || $content !~ /$re/;
+    }
+
+    if ( $old_state eq 'pending activation' ) {
         # switch to active state if it is reply from requestor(s)
-        return 'active' if $txn->Type eq 'Correspond'
-                           && $t->Requestors->HasMember( $txn->CreatorObj->PrincipalObj );
-        return '';
+        return 'active';
     } elsif ( $old_state eq 'pending removal' ) {
         # switch to removed state when requestor(s) replies
         # but do it via changing status!
-        return '' unless $txn->Type eq 'Correspond';
-        return '' unless $t->Requestors->HasMember( $txn->CreatorObj->PrincipalObj );
         my ($val, $msg) = $t->SetStatus( 'resolved' );
         $RT::Logger->error("Couldn't change status: $msg") unless $val;
         return '';


More information about the Rt-commit mailing list