[Rt-commit] rt branch, 4.4/hide-onetime-cc-suggestions, created. rt-4.4.1-102-g89381b7

Dustin Graves dustin at bestpractical.com
Mon Aug 15 17:28:52 EDT 2016


The branch, 4.4/hide-onetime-cc-suggestions has been created
        at  89381b7c9d58a5efbd7f32bd6e869e9fe740149e (commit)

- Log -----------------------------------------------------------------
commit 89381b7c9d58a5efbd7f32bd6e869e9fe740149e
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Thu Aug 11 22:33:02 2016 +0000

    add config option HideCcSuggestions to hide one-time Cc and Bcc email addresses
    
    this encapsulates the list of email addresses in a toggleable div with
    (show suggestions) and (hide suggestions) links
    
    Fixes: T#168228

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 705c6c9..4627f22 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -3864,8 +3864,24 @@ Admin -> Tools menu for SuperUsers.
 
 Set($StatementLog, undef);
 
+=item C<$HideOneTimeSuggestions>
+
+On ticket comment and correspond there are "One-time Cc" and "One-time Bcc"
+fields. As part of this section, RT includes a list of suggested email
+addresses based on the correspondence history for that ticket. This list may
+grow quite large over time.
+
+Enabling this option will hide the list behind a "(show suggestions)" link to
+cut down on page clutter. Once this option is clicked the link will change to
+"(hide suggestions)" and the full list of email addresses will be shown.
+
+=cut
+
+Set($HideOneTimeSuggestions, 0);
+
 =back
 
+
 =cut
 
 1;
diff --git a/share/html/Ticket/Elements/UpdateCc b/share/html/Ticket/Elements/UpdateCc
index c7d2637..641fa33 100644
--- a/share/html/Ticket/Elements/UpdateCc
+++ b/share/html/Ticket/Elements/UpdateCc
@@ -52,6 +52,12 @@
         <br />
 
 %if (scalar @one_time_Ccs) {
+%   if ($hide_cc_suggestions) {
+        <a href="#" class="ToggleSuggestions" data-hide-label="<% $hide_label %>" data-show-label="<% $show_label %>">
+            <i class="label">(<&|/l&>show suggestions</&>)</i>
+        </a>
+        <div class="OneTimeCcs hidden">
+%   }
 <i class="label">(<&|/l&>check to add</&>)</i>
 %}
 %foreach my $addr ( @one_time_Ccs ) {
@@ -65,9 +71,18 @@
     <% $ARGS{'UpdateCc-'.$addr} ? 'checked="checked"' : ''%> >
       <label for="UpdateCc-<%$addr%>"><& /Elements/ShowUser, Address => $txn_addresses{$addr}&></label>
 %}
+%if (@one_time_Ccs && $hide_cc_suggestions) {
+</div>
+%}
 </td></tr>
 <tr><td class="label"><&|/l&>One-time Bcc</&>:</td><td><& /Elements/EmailInput, Name => 'UpdateBcc', Size => undef, Default => $ARGS{UpdateBcc}, AutocompleteMultiple => 1 &><br />
 %if (scalar @one_time_Ccs) {
+%   if ($hide_cc_suggestions) {
+        <a href="#" class="ToggleSuggestions" data-hide-label="<% $hide_label %>" data-show-label="<% $show_label %>">
+            <i class="label">(<&|/l&>show suggestions</&>)</i>
+        </a>
+        <div class="OneTimeCcs hidden">
+%   }
 <i class="label">(<&|/l&>check to add</&>)</i>
 %}
 %foreach my $addr ( @one_time_Ccs ) {
@@ -81,6 +96,21 @@
     <% $ARGS{'UpdateBcc-'.$addr} ? 'checked="checked"' : ''%> >
       <label for="UpdateBcc-<%$addr%>"><& /Elements/ShowUser, Address => $txn_addresses{$addr}&></label>
 %}
+%if (@one_time_Ccs && $hide_cc_suggestions) {
+</div>
+<script type="text/javascript">
+jQuery(function() {
+    jQuery('a.ToggleSuggestions').click(function(e) {
+        e.preventDefault();
+        var toggleSuggestions = jQuery(this);
+        var oneTimeCcs = toggleSuggestions.closest('td').find('.OneTimeCcs');
+        oneTimeCcs.toggleClass('hidden');
+        var hideOrShow = oneTimeCcs.hasClass('hidden') ? toggleSuggestions.data('showLabel') : toggleSuggestions.data('hideLabel');
+        toggleSuggestions.find('i').html('(' + hideOrShow + ')');
+    });
+});
+</script>
+%}
 </td></tr>
 <%args>
 $TicketObj
@@ -100,4 +130,8 @@ foreach my $addr ( keys %txn_addresses) {
   next if ( grep {$addr eq lc $_->address} @people_addresses );
   push @one_time_Ccs,$addr;
 }
+
+my $hide_cc_suggestions =  RT->Config->Get('HideOneTimeSuggestions', $session{CurrentUser});
+my $show_label    = $m->interp->apply_escapes( loc("show suggestions"), 'h' );
+my $hide_label    = $m->interp->apply_escapes( loc("hide suggestions"), 'h' );
 </%init>

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


More information about the rt-commit mailing list