[Bps-public-commit] r15202 - in RT-Extension-CommandByEmail: . t

sartak at bestpractical.com sartak at bestpractical.com
Sun Aug 17 21:35:56 EDT 2008


Author: sartak
Date: Sun Aug 17 21:35:56 2008
New Revision: 15202

Modified:
   RT-Extension-CommandByEmail/   (props changed)
   RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm
   RT-Extension-CommandByEmail/t/00.load.t

Log:
 r69688 at onn:  sartak | 2008-08-17 21:35:51 -0400
 Better check for oldstyle/newstyle config


Modified: RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm
==============================================================================
--- RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm	(original)
+++ RT-Extension-CommandByEmail/lib/RT/Interface/Email/Filter/TakeAction.pm	Sun Aug 17 21:35:56 2008
@@ -166,10 +166,10 @@
 
     # If only a particular group may perform commands by mail,
     # bail out
-    my $old_config = $RT::VERSION =~ /3\.(\d+)/ && $1 < 7;
-    my $group_id = $old_config
-                 ? $RT::CommandByMailGroup
-                 : RT->Config->Get('CommandByMailGroup');
+    my $new_config = RT->can('Config') && RT->Config->can('Get');
+    my $group_id = $new_config
+                 ? RT->Config->Get('CommandByMailGroup')
+                 : $RT::CommandByMailGroup;
 
     if (defined $group_id) {
         my $group = RT::Group->new($args{'CurrentUser'});

Modified: RT-Extension-CommandByEmail/t/00.load.t
==============================================================================
--- RT-Extension-CommandByEmail/t/00.load.t	(original)
+++ RT-Extension-CommandByEmail/t/00.load.t	Sun Aug 17 21:35:56 2008
@@ -10,15 +10,15 @@
 
 diag( "Testing RT::Extension::CommandByMail $RT::Extension::CommandByMail::VERSION" );
 
-my $old_config = $RT::VERSION =~ /3\.(\d+)/ && $1 < 7;
+my $new_config = RT->can('Config') && RT->Config->can('Get');
 
-my @plugins = $old_config
-            ? @RT::Plugins
-            : RT->Config->Get('Plugins');
-
-my @mail_plugins = $old_config
-                 ? @RT::MailPlugins
-                 : RT->Config->Get('MailPlugins');
+my @plugins = $new_config
+            ? RT->Config->Get('Plugins')
+            : @RT::Plugins;
+
+my @mail_plugins = $new_config
+                 ? RT->Config->Get('MailPlugins')
+                 : @RT::MailPlugins;
 
 my $complain = 0;
 ok((grep { $_ eq 'RT::Extension::CommandByMail' } @plugins), "RT::Extension::CommandByMail is in your config's \@Plugins") or $complain = 1;



More information about the Bps-public-commit mailing list