[Rt-commit] rt branch, squelch, updated. rt-3.8.8-303-g64f5bd8

Alex Vandiver alexmv at bestpractical.com
Tue Sep 7 17:13:39 EDT 2010


The branch, squelch has been updated
       via  64f5bd87c841fba903cdba9a5160f81ab70e662e (commit)
      from  25792acd72a7afb4c538c0a449edb59afb726553 (commit)

Summary of changes:
 share/html/Ticket/Elements/PreviewScrips |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit 64f5bd87c841fba903cdba9a5160f81ab70e662e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 7 16:16:37 2010 -0400

    Invert the way squelching works -- you now uncheck boxes to remove recipients

diff --git a/share/html/Ticket/Elements/PreviewScrips b/share/html/Ticket/Elements/PreviewScrips
index 8e08b40..30fc423 100755
--- a/share/html/Ticket/Elements/PreviewScrips
+++ b/share/html/Ticket/Elements/PreviewScrips
@@ -49,11 +49,13 @@
 $TicketObj => undef
 </%args>
 <%init>
-my $arg = 'Ticket-'.$TicketObj->Id.'-SquelchMailTo';
-my @squelchto = ref($ARGS{$arg}) eq 'ARRAY' ? @{$ARGS{$arg}} : ($ARGS{$arg});
+my %diff;
+$diff{$_}++ for Email::Address->parse($ARGS{"Ticket-".$TicketObj->Id."-Recipients"});
+my $arg = 'Ticket-'.$TicketObj->Id.'-SendMailTo';
+$diff{$_}-- for grep {$_} ref($ARGS{$arg}) eq 'ARRAY' ? @{$ARGS{$arg}} : ($ARGS{$arg});
 
-foreach my $address (@squelchto) {
-        $TicketObj->SquelchMailTo($address) if ($address);
+foreach my $address (grep {$diff{$_} > 0} keys %diff) {
+    $TicketObj->SquelchMailTo($address);
 }
 
 
@@ -61,16 +63,17 @@ $arg = 'Ticket-'.$TicketObj->Id.'-UnsquelchMailTo';
 my @unsquelchto = ref($ARGS{$arg}) eq 'ARRAY' ? @{$ARGS{$arg}} : ($ARGS{$arg});
 
 foreach my $address (@unsquelchto) {
-        $TicketObj->UnsquelchMailTo($address) if ($address);
+    $TicketObj->UnsquelchMailTo($address) if ($address);
 }
 
 my $Object = $TicketObj->DryRun(%ARGS);
 my @non_recipients = $TicketObj->SquelchMailTo;
+my @recipients;
 </%init>
 <h2><&|/l&>This message will be sent to...</&></h2>
 
 % if ( $Object and $Object->Scrips ) {
-<i><&|/l&>(Check boxes to disable notifications to the listed recipients)</&></i><br />
+<i><&|/l&>(Uncheck boxes to disable notifications to the listed recipients)</&></i><br />
 
 % foreach my $scrip (@{$Object->Scrips->Prepared}) {
 % next unless $scrip->ActionObj->Action->isa('RT::Action::SendEmail');
@@ -82,9 +85,10 @@ my @non_recipients = $TicketObj->SquelchMailTo;
 <ul>
 %foreach my $addr (@addresses) {
 <li>
-    <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="Ticket-<%$TicketObj->id%>-SquelchMailTo" value="<%$addr->address%>" /> <%$addr->address%>
+    <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="Ticket-<%$TicketObj->id%>-SendMailTo" checked="1" value="<%$addr->address%>" /> <%$addr->address%>
 
 % $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
+% push @recipients, $addr->address;
 </li>
 % }
 </ul>
@@ -106,9 +110,10 @@ my @non_recipients = $TicketObj->SquelchMailTo;
 <ul>
 %        foreach my $address (@{$data->{$type}}) {
 <li>
-    <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="Ticket-<%$TicketObj->id%>-SquelchMailTo" value="<%$address%>" /> <%$address%>
+    <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="Ticket-<%$TicketObj->id%>-SendMailTo" value="<%$address%>" /> <%$address%>
 
 %            $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => Email::Address->parse($address), Type => $type);
+% push @recipients, $address;
 </li>
 %        }
 </ul>
@@ -116,6 +121,7 @@ my @non_recipients = $TicketObj->SquelchMailTo;
 %   }
 % }
 % }
+<input type="hidden" name="Ticket-<%$TicketObj->id%>-Recipients" value="<%join(",", at recipients)%>" />
 <br />
 
 <h2><&|/l&>Messages about this ticket will not be sent to...</&></h2>

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


More information about the Rt-commit mailing list