[Rt-commit] rt branch, 4.4/squelch-one-time-recipients, created. rt-4.4.3-194-g7b048865d

? sunnavy sunnavy at bestpractical.com
Wed Feb 20 17:31:16 EST 2019


The branch, 4.4/squelch-one-time-recipients has been created
        at  7b048865db28ce6f558a3c7c487727190718e9c8 (commit)

- Log -----------------------------------------------------------------
commit 7b048865db28ce6f558a3c7c487727190718e9c8
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Feb 21 05:42:49 2019 +0800

    Allow to squelch recipients that also exist in one time inputs
    
    In 251d581724, to fix the SquelchMailTo attribute, we excluded addresses
    in UpdateCc/UpdateBcc fields from squelching considering addresses in
    UpdateCc/UpdateBcc will always get notifications.  This is not quite
    accurate.
    
    There are cases where people want to hide some addresses from others, to
    do so, they can not totally depend on the role(Requestor, Cc, AdminCc,
    etc) to send notifications, but need to explicitly Bcc to ones they want
    to hide.  e.g. to hide "foo at localhost" from "bar at localhost", the
    recipient list could be like:
    
            To: [✓] bar at localhost
                [ ] foo at localhost
            Bcc:    foo at localhost (explicit one-time Bcc)
    
    Previously we didn't actually support this and "foo at localhost" would be
    added to "To" address even if "foo at localhost" is unchecked like above.
    
    This commit fixes this issue while keeping SquelchMailTo attribute
    accurate enough: in the above example, the SquelchMailTo will contain
    just "foo at localhost"

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index e4b65ba2b..6b1ff28ec 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -3774,12 +3774,6 @@ sub ProcessTransactionSquelching {
         (    ref $args->{'TxnSendMailTo'} eq "ARRAY"  ? @{$args->{'TxnSendMailTo'}} :
          defined $args->{'TxnSendMailTo'}             ?  ($args->{'TxnSendMailTo'}) :
                                                                              () );
-    for my $type ( qw/Cc Bcc/ ) {
-        next unless $args->{"Update$type"};
-        for my $addr ( Email::Address->parse( $args->{"Update$type"} ) ) {
-            $checked{$addr->address} ||= 1;
-        }
-    }
     my %squelched = map { $_ => 1 } grep { not $checked{$_} } split /,/, ($args->{'TxnRecipients'}||'');
     return %squelched;
 }
diff --git a/share/html/Helpers/PreviewScrips b/share/html/Helpers/PreviewScrips
index 14fa77344..fa3a13d59 100644
--- a/share/html/Helpers/PreviewScrips
+++ b/share/html/Helpers/PreviewScrips
@@ -109,7 +109,6 @@ $submitted{$_} = 1 for split /,/, $ARGS{TxnRecipients};
                   <li>
 %                 my $checked = $submitted{$addr->address} ? not $squelched{$addr->address} : $squelched_config;
 %                 $m->callback(CallbackName => 'BeforeAddress', Ticket => $TicketObj, Address => $addr, Type => $type, Checked => \$checked);
-%                 $recips{$addr->address}++;
                   <b><%loc($type)%></b>:
 %                 my $show_checkbox = 1;
 %                 if ( grep {$_ eq $addr->address} @{$action->{NoSquelch}{$type}} ) {
@@ -117,9 +116,14 @@ $submitted{$_} = 1 for split /,/, $ARGS{TxnRecipients};
 %                 }
 
 %                 if ( $show_checkbox ) {
+%                     $recips{$addr->address}++;
                       <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$addr->address%>" id="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>" />
 %                 }
-                  <label for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"><& /Elements/ShowUser, Address => $addr &></label>
+                  <label
+%                   if ( $show_checkbox ) {
+                        for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"
+%                   }
+                  ><& /Elements/ShowUser, Address => $addr &></label>
 %                 $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
 %                 unless ( $show_checkbox ) {
 %                     if ( $type eq 'Cc' ) {

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


More information about the rt-commit mailing list