[Rt-commit] rt 02/04: Implement queue level filtering of ticket history
craig kaiser
craig at bestpractical.com
Fri Jul 30 15:09:52 UTC 2021
This is an automated email from the git hooks/post-receive script.
craig pushed a commit to branch 5.0/core-history-filter
in repository rt.
commit 481fef1029394bfef64ce35a9a4112937985b81a
Author: craig kaiser <craig at bestpractical.com>
AuthorDate: Mon Jul 12 11:26:54 2021 -0400
Implement queue level filtering of ticket history
---
share/html/Admin/Elements/EditHistoryFilter | 29 +++++++++++++++++++++++++++++
share/html/Admin/Queues/Modify.html | 22 ++++++++++++++++++++++
share/html/Elements/ShowHistoryPage | 6 ++++++
3 files changed, 57 insertions(+)
diff --git a/share/html/Admin/Elements/EditHistoryFilter b/share/html/Admin/Elements/EditHistoryFilter
new file mode 100644
index 0000000000..dbd5c15145
--- /dev/null
+++ b/share/html/Admin/Elements/EditHistoryFilter
@@ -0,0 +1,29 @@
+<div class="form-row">
+ <div class="label col-3">
+ <&|/l&>History Filter</&>:
+ </div>
+ <div class="value col-9">
+ <select name="HistoryFilter" class="selectpicker form-control" multiple>
+% foreach my $type ( @options ) {
+% my $selected = '';
+% $selected = 'selected="selected"' if grep {$_ eq $type} @{$default};
+
+ <option <% $selected |n %> value="<% $type %>"><% loc( $type ) %></option>
+% }
+ </select>
+ </div>
+</div>
+
+<%INIT>
+return unless $QueueObj;
+
+my $queue_attribute = $QueueObj->FirstAttribute( 'HistoryFilter' );
+my $default = $queue_attribute ? $queue_attribute->Content : [];
+
+my @options = RT->Config->Get( 'HistoryFilterTypes' );
+</%INIT>
+
+<%ARGS>
+$QueueObj => undef
+ at HistoryFilter => ()
+</%ARGS>
diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index e9e859632e..8a9faf15ac 100644
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -239,6 +239,12 @@
</div>
% }
+ <div class="form-row">
+ <div class="col-12"> <% # colspan=4 %>
+ <& /Admin/Elements/EditHistoryFilter, QueueObj => $QueueObj, %ARGS &>
+ </div>
+ </div>
+
</&>
<div class="form-row">
<div class="col-12">
@@ -325,6 +331,21 @@ if ( $QueueObj->Id ) {
if ( !$QueueObj->SLADisabled && !( RT->Config->Get('ServiceAgreements') && keys %{RT->Config->Get('ServiceAgreements')}) ) {
push @no_redirect_results, loc("You enabled [_1] but [_2] hasn't been configured in RT_SiteConfig.pm, please check '[_3]' for more help", 'SLA', '%ServiceAgreements', 'docs/customizing/sla.pod');
}
+
+ my $history_filter_attribute = $QueueObj->FirstAttribute( 'HistoryFilter' );
+ my $default_history_filter = $history_filter_attribute ? $history_filter_attribute->Content : [];
+
+ # Don't update if nothing needs changing
+ unless ( @{$default_history_filter} == @HistoryFilter ) {
+ my ($ret, $msg) = $QueueObj->SetAttribute( Name => 'HistoryFilter', Content => \@HistoryFilter );
+ if ( $ret ) {
+ push @no_redirect_results, loc("Histroy Filter Updated");
+ }
+ else {
+ RT::Logger->error( "Could not set History Filter queue attribute: $msg" );
+ push @no_redirect_results, loc("Failed to update History Filter setting");
+ }
+ }
} else {
$title = loc("Create a queue");
}
@@ -355,4 +376,5 @@ $SetCrypt => undef
$SLAEnabled => undef
$Enabled => undef
$SortOrder => undef
+ at HistoryFilter => ()
</%ARGS>
diff --git a/share/html/Elements/ShowHistoryPage b/share/html/Elements/ShowHistoryPage
index 1c01345bdf..8184dbbd7b 100644
--- a/share/html/Elements/ShowHistoryPage
+++ b/share/html/Elements/ShowHistoryPage
@@ -128,6 +128,12 @@ while ( my $Transaction = $Transactions->Next ) {
and RT::Config->Get('SelfServiceCorrespondenceOnly')
and ($Transaction->Type ne "Correspond" && $Transaction->Type ne "Create");
+ if ( $Object->isa('RT::Ticket') && $Object->QueueObj->FirstAttribute( 'HistoryFilter' ) ) {
+ my $filter_types = $Object->QueueObj->FirstAttribute( 'HistoryFilter' )->Content;
+
+ $skip = 1 if not grep {$_ eq $Transaction->Type} @{$filter_types};
+ }
+
$m->callback(
%ARGS,
Transaction => $Transaction,
--
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.
More information about the rt-commit
mailing list