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

Dustin Graves dustin at bestpractical.com
Thu Aug 11 18:35:13 EDT 2016


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

- Log -----------------------------------------------------------------
commit 4aa70abe8ee65ee0c13c33fd7bc438b96325dadf
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..597c967 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -3866,6 +3866,24 @@ Set($StatementLog, undef);
 
 =back
 
+=item C<$HideCcSuggestions>
+
+One 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($HideCcSuggestions, 0);
+
+=back
+
+
 =cut
 
 1;
diff --git a/share/html/Elements/JavascriptConfig b/share/html/Elements/JavascriptConfig
index 0484957..cdc015a 100644
--- a/share/html/Elements/JavascriptConfig
+++ b/share/html/Elements/JavascriptConfig
@@ -72,6 +72,8 @@ my $Catalog = {
     loading => "Loading...", #loc
     try_again => "Try again", #loc
     history_scroll_error => "Could not load ticket history. Reason:", #loc
+    hide_suggestions => "hide suggestions", #loc
+    show_suggestions => "show suggestions", #loc
 };
 $_ = loc($_) for values %$Catalog;
 
diff --git a/share/html/Ticket/Elements/UpdateCc b/share/html/Ticket/Elements/UpdateCc
index c7d2637..e7948be 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">
+            <i class="label">(<&|/l&>show suggestions</&>)</i>
+        </a>
+        <div class="OneTimeCcs" style="display:none">
+%   }
 <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 (scalar @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">
+            <i class="label">(<&|/l&>show suggestions</&>)</i>
+        </a>
+        <div class="OneTimeCcs" style="display:none">
+%   }
 <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 (scalar @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.toggle();
+        var hideOrShow = (oneTimeCcs.is(":visible") ? 'hide' : 'show') + '_suggestions';
+        toggleSuggestions.find('i').html('(' + loc_key(hideOrShow) + ')');
+    });
+});
+</script>
+%}
 </td></tr>
 <%args>
 $TicketObj
@@ -100,4 +130,6 @@ 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('HideCcSuggestions', $session{CurrentUser});
 </%init>

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


More information about the rt-commit mailing list