Skip to content

Commit

Permalink
Invert the way squelching works -- you now uncheck boxes to remove re…
Browse files Browse the repository at this point in the history
…cipients
  • Loading branch information
alexmv committed Sep 7, 2010
1 parent 25792ac commit 64f5bd8
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions share/html/Ticket/Elements/PreviewScrips
Expand Up @@ -49,28 +49,31 @@
$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);
}


$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');
Expand All @@ -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>
Expand All @@ -106,16 +110,18 @@ 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>

% }
% }
% }
<input type="hidden" name="Ticket-<%$TicketObj->id%>-Recipients" value="<%join(",",@recipients)%>" />
<br />

<h2><&|/l&>Messages about this ticket will not be sent to...</&></h2>
Expand Down

0 comments on commit 64f5bd8

Please sign in to comment.