[Rt-commit] rt branch, 4.4/preview-batch, updated. rt-4.2.5-189-gd0fc383

Alex Vandiver alexmv at bestpractical.com
Wed Jul 23 15:34:23 EDT 2014


The branch, 4.4/preview-batch has been updated
       via  d0fc383945129fbfc17b9877004566af7cfff731 (commit)
      from  9c478173ec9283aad0b3cf0b284228cb82f62dd0 (commit)

Summary of changes:
 share/html/Helpers/PreviewScrips            | 25 -------------------------
 share/html/Helpers/ShowSimplifiedRecipients |  9 ---------
 2 files changed, 34 deletions(-)

- Log -----------------------------------------------------------------
commit d0fc383945129fbfc17b9877004566af7cfff731
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 23 13:47:42 2014 -0400

    Remove mostly-duplicate code for Rules which can never trigger
    
    PreviewScrips includes a mostly-duplicated block of code to preview
    emails produced by Rules, the mechanism behind Approvals.  However, this
    code is unnecessary because /Ticket/Update.html is not accessible for
    tickets of type 'approval' (the only objects which could currently
    trigger Rules in a stock RT), because /Tickets/autohandler redirects all
    but a small number of files under /Tickets/ to /Approvals/ instead.
    /Ticket/Update.html is not in the whitelist, and thus cannot render for
    Approvals.
    
    Furthermore, the code checks $rule->{hints}{class} to determine if it
    should display the rule; no rule ever has a ->{hints} set on it, and
    never has, since the introduction of this code in 6d14f535.  As such,
    even if /Ticket/Update.html were accessible, or some local customization
    made use of Rules for something other than Approvals, they would still
    not appear in PreviewScrips.
    
    Remove the duplicated and unused code.

diff --git a/share/html/Helpers/PreviewScrips b/share/html/Helpers/PreviewScrips
index ef7db09..a27c8f7 100644
--- a/share/html/Helpers/PreviewScrips
+++ b/share/html/Helpers/PreviewScrips
@@ -130,31 +130,6 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
 %     }
 % }
 
-% my @rules = map {@{$_->Rules}} @dryrun;
-% if ( @rules ) {
-%     for my $rule (@rules) {
-%         next unless $rule->{hints} && $rule->{hints}{class} eq 'SendEmail';
-          <b><% $rule->Describe %></b>
-%         my $data = $rule->{hints}{recipients};
-%         for my $type (qw(To Cc Bcc)) {
-%             next unless @{$data->{$type}};
-              <ul>
-%             for my $address (@{$data->{$type}}) {
-                  <li>
-%                 my $checked = not $squelched{$address};
-%                 $m->callback(CallbackName => 'BeforeAddress', Ticket => $TicketObj, Address => Email::Address->parse($address), Type => $type, Checked => \$checked);
-%                 $recips{$address}++;
-                  <b><%loc($type)%></b>: <input type="checkbox" class="checkbox" name="TxnSendMailTo" <% $checked ? 'checked="checked"' : '' |n%> value="<%$address%>" id="TxnSendMailTo-<% $address %>-<% $recips{$address} %>" />
-                  <label for="TxnSendMailTo-<% $address %>-<% $recips{$address} %>"><%$address%></label>
-%                 $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => Email::Address->parse($address), Type => $type);
-                  </li>
-%             }
-              </ul>
-%         }
-          <br />
-%     }
-% }
-
 % $m->callback( CallbackName => 'AfterRecipients', TicketObj => $TicketObj );
 
 <input type="hidden" name="TxnRecipients" value="<% join ",",sort keys %recips %>" />
diff --git a/share/html/Helpers/ShowSimplifiedRecipients b/share/html/Helpers/ShowSimplifiedRecipients
index 68e86cc..4c6b60c 100644
--- a/share/html/Helpers/ShowSimplifiedRecipients
+++ b/share/html/Helpers/ShowSimplifiedRecipients
@@ -92,15 +92,6 @@ if (@scrips) {
         }
     }
 }
-my @rules = map {@{$_->Rules}} @dryrun;
-if (@rules) {
-    for my $rule (grep {$_->{hints} and $_->{hints}{class} eq "SendEmail"} @rules) {
-        for my $type (qw(To Cc Bcc)) {
-            $headers{$type}{$_} ||= @{[Email::Address->parse($_)]}[0] # Hate list context
-                for @{$rule->{hints}{recipients}{$type}};
-        }
-    }
-}
 my %recips;
 my %squelched = ProcessTransactionSquelching( \%ARGS );
 </%init>

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


More information about the rt-commit mailing list