[Rt-commit] rt branch, 4.4/ajax-preview-scrips, updated. rt-4.2.3-208-g3af7307

Alex Vandiver alexmv at bestpractical.com
Mon Jul 14 16:06:06 EDT 2014


The branch, 4.4/ajax-preview-scrips has been updated
       via  3af73070f35733de64f5fc4289aefea49a9c24bc (commit)
       via  7d52fbc2301232328bf3bb1a502629d7e5c7f7c5 (commit)
      from  cb750e1f93a6ed15d7880057565d0890e8349e32 (commit)

Summary of changes:
 share/html/Helpers/ShowSimplifiedRecipients | 29 +++++++--------
 share/html/Ticket/Update.html               | 56 +++++++++++------------------
 2 files changed, 36 insertions(+), 49 deletions(-)

- Log -----------------------------------------------------------------
commit 7d52fbc2301232328bf3bb1a502629d7e5c7f7c5
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 14 15:42:51 2014 -0400

    Don't show checkboxes for one-time Ccs unless they are actually squelchable

diff --git a/share/html/Helpers/ShowSimplifiedRecipients b/share/html/Helpers/ShowSimplifiedRecipients
index ab45134..26d5ead 100644
--- a/share/html/Helpers/ShowSimplifiedRecipients
+++ b/share/html/Helpers/ShowSimplifiedRecipients
@@ -65,16 +65,18 @@ my $Object = $TicketObj->DryRun(%ARGS);
 $m->abort unless $Object;
 
 my %headers = (To => {}, Cc => {}, Bcc => {});
-my %no_squelch;
+my %no_squelch = (To => {}, Cc => {}, Bcc => {});
 if ($Object->Scrips) {
     for my $scrip (grep $_->ActionObj->Action->isa('RT::Action::SendEmail'), @{$Object->Scrips->Prepared}) {
         my $action = $scrip->ActionObj->Action;
         for my $type (qw(To Cc Bcc)) {
-            $headers{$type}{$_->address} = $_
-                for $action->$type();
-        }
-        for my $type ( keys %{$action->{NoSquelch}} ) {
-            $no_squelch{$type}{$_} ||= 1 for @{$action->{NoSquelch}{$type}};
+            for my $addr ($action->$type()) {
+                if (grep {$addr->address eq $_} @{$action->{NoSquelch}{$type} || []}) {
+                    $no_squelch{$type}{$addr->address} = $addr;
+                } else {
+                    $headers{$type}{$addr->address} = $addr;
+                }
+            }
         }
     }
 }
@@ -91,7 +93,7 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
 </%init>
 <table>
 % for my $type (qw(To Cc Bcc)) {
-%     next unless keys %{$headers{$type}};
+%     next unless keys %{$headers{$type}} or keys %{$no_squelch{$type}};
 <tr>
 <td valign="top"><% $type %>:</td>
 <td valign="top">
@@ -103,16 +105,15 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
 <label for="TxnSendMailTo-<% $addr->address %>-<% $recips{$addr->address} %>"><& /Elements/ShowUser, Address => $addr &></label>
 %         $m->callback(CallbackName => 'AfterAddress', Ticket => $TicketObj, Address => $addr, Type => $type);
 <br />
-%         if ( $no_squelch{$type}{$addr} ) {
+%     }
+%     for my $addr (sort {$a->address cmp $b->address} values %{$no_squelch{$type}}) {
 <label><& /Elements/ShowUser, Address => $addr &></label>
-%             if ( $type eq 'Cc' ) {
+%         if ( $type eq 'Cc' ) {
 (<&|/l&>explicit one-time Cc</&>)
-%             }
-%             else {
+%         } else {
 (<&|/l&>explicit one-time Bcc</&>)
-%             }
-<br />
 %         }
+<br />
 %     }
 </td></tr>
 % }
@@ -126,4 +127,4 @@ my %squelched = ProcessTransactionSquelching( \%ARGS );
 % unless ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
     <input type="hidden" name="TxnRecipients" value="<% join ",",sort keys %recips %>" />
 % }
-% $m->abort();
\ No newline at end of file
+% $m->abort();

commit 3af73070f35733de64f5fc4289aefea49a9c24bc
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 14 15:52:38 2014 -0400

    Unify recipients and previews javascript

diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index e9f3cc4..30ff35f 100644
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -137,25 +137,6 @@
 
 <div id="ticket-update-message">
 % if ( RT->Config->Get('SimplifiedRecipients', $session{'CurrentUser'}) ) {
-<script type="text/javascript">
-jQuery( function() {
-   jQuery("#ticket-update-metadata :input, input[name^=UpdateCc], input[name^=UpdateBcc]").change( function() {
-       jQuery('#recipients div.titlebox-content').load( '<% RT->Config->Get('WebPath')%>/Helpers/ShowSimplifiedRecipients',
-           jQuery('form[name=TicketUpdate]').serialize(),
-           function() {
-% unless ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
-               jQuery("input[name=TxnSendMailTo]").change(function(ev) {
-                   jQuery("input[name=TxnSendMailTo]").filter( function() { return this.value == ev.target.value; } ).prop("checked",jQuery(ev.target).prop('checked'));
-               });
-% }
-        });
-   });
-% unless ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
-   jQuery('#UpdateType').change();
-% }
-});
-</script>
-
     <&|/Widgets/TitleBox, title => loc('Recipients'), id => 'recipients' &>
     </&>
 %}
@@ -207,22 +188,6 @@ jQuery( function() {
 % $m->callback( %ARGS, CallbackName => 'BeforeScrips', Ticket => $TicketObj );
 
 % if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
-<script type="text/javascript">
-jQuery( function() {
-   jQuery("#ticket-update-metadata :input, input[name^=UpdateCc], input[name^=UpdateBcc]").change( function() {
-       jQuery('#previewscrips div.titlebox-content').load( '<% RT->Config->Get('WebPath')%>/Helpers/PreviewScrips',
-           jQuery('form[name=TicketUpdate]').serialize(),
-           function() {
-               jQuery("input[name=TxnSendMailTo]").change(function(ev) {
-                   jQuery("input[name=TxnSendMailTo]").filter( function() { return this.value == ev.target.value; } ).prop("checked",jQuery(ev.target).prop('checked'));
-               });
-           }
-       );
-   });
-   jQuery('#UpdateType').change();
-});
-</script>
-
   <&|/Widgets/TitleBox, title => loc('Scrips and Recipients'), id => 'previewscrips', rolledup => RT->Config->Get('SimplifiedRecipients', $session{'CurrentUser'}) &>
   </&>
 % }
@@ -235,6 +200,27 @@ jQuery( function() {
 
 % $m->callback( %ARGS, CallbackName => 'AfterForm', Ticket => $TicketObj );
 
+% if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail') or RT->Config->Get('SimplifiedRecipients', $session{'CurrentUser'})) {
+<script type="text/javascript">
+jQuery( function() {
+   var updateScrips = function() {
+       var syncCheckboxes = function(ev) {
+           jQuery("input[name=TxnSendMailTo]").filter( function() { return this.value == ev.target.value; } ).prop("checked",jQuery(ev.target).prop('checked'));
+       };
+       jQuery('#recipients div.titlebox-content').load( '<% RT->Config->Get('WebPath')%>/Helpers/ShowSimplifiedRecipients',
+           jQuery('form[name=TicketUpdate]').serialize(),
+           function() { jQuery("#recipients input[name=TxnSendMailTo]").change( syncCheckboxes ); }
+       );
+       jQuery('#previewscrips div.titlebox-content').load( '<% RT->Config->Get('WebPath')%>/Helpers/PreviewScrips',
+           jQuery('form[name=TicketUpdate]').serialize(),
+           function() { jQuery("#previewscrips input[name=TxnSendMailTo]").change( syncCheckboxes ); }
+       );
+   };
+   updateScrips();
+   jQuery("#ticket-update-metadata :input, input[name^=UpdateCc], input[name^=UpdateBcc]").change( updateScrips );
+});
+</script>
+% }
 <%INIT>
 my $CanRespond = 0;
 my $CanComment = 0;

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


More information about the rt-commit mailing list