[Bps-public-commit] r9279 - RT-Extension-TicketLocking/html/Callbacks/RT-Extension-TicketLocking/Ticket/Display.html

ruz at bestpractical.com ruz at bestpractical.com
Thu Oct 11 16:52:44 EDT 2007


Author: ruz
Date: Thu Oct 11 16:52:41 2007
New Revision: 9279

Modified:
   RT-Extension-TicketLocking/html/Callbacks/RT-Extension-TicketLocking/Ticket/Display.html/BeforeActionList

Log:
* get rid of uninit warning
* cleanup code a little bit

Modified: RT-Extension-TicketLocking/html/Callbacks/RT-Extension-TicketLocking/Ticket/Display.html/BeforeActionList
==============================================================================
--- RT-Extension-TicketLocking/html/Callbacks/RT-Extension-TicketLocking/Ticket/Display.html/BeforeActionList	(original)
+++ RT-Extension-TicketLocking/html/Callbacks/RT-Extension-TicketLocking/Ticket/Display.html/BeforeActionList	Thu Oct 11 16:52:41 2007
@@ -1,17 +1,15 @@
+<& /Elements/ShowLock, %ARGS &>
 <%ARGS>
 $Duration => undef
 $Actions => undef
 </%ARGS>
-
 <%INIT>
 #A somewhat inelegant hack to get around /Ticket/Display.html's redirect, which nukes all
 #variables except for id
 unless($Duration) {
-    my @msg = grep(qr{You have unlocked this ticket\. It was locked for (\d+) seconds\.}i, @$Actions); 
-    my $msg = pop @msg;
-    $msg =~ /(You have unlocked this ticket\.) It was locked for (\d+) seconds\./i;
-    $ARGS{'Duration'} = $2 if $2 && $2 !~ /\./;
+    my $msg = (grep m{You have unlocked this ticket\. It was locked for (\d+) seconds\.}i, @$Actions)[-1];
+    if ( $msg && $msg =~ /(You have unlocked this ticket\.) It was locked for (\d+) seconds\./i ) {
+        $ARGS{'Duration'} = $2 if $2 && $2 !~ /\./;
+    }
 }
-$m->comp('/Elements/ShowLock', %ARGS);
-return;
 </%INIT>



More information about the Bps-public-commit mailing list