Request Tracker Wiki


870pages on
this wiki

Hiding transactions in tickets' history Edit

Introdduction Edit

You should be familiar with CustomizingWithCallbacks as all examples here are based on 'SkipTransaction' callback in Ticket/Elements/ShowHistory Mason component. Create a Callback 'SkipTransaction' in local/html/Callbacks/<MyCallbacks>/Ticket/Elements/ShowHistory/SkipTransaction and pick code below.

For RT 4.2.0 and above Ticket/Elements/ShowHistory no longer exists.  You will need to hook Elements/ShowHistory's SkipTransaction instead.  Keep in mind that this means your transactions may apply to users or queues in addition to tickets and you should tread carefully.

SkipTransaction callback allows your code to set $$skip variable if you want to skip the current transaction.

Minimal example Edit

This is minimal example as starting point that hides all transactions created by the system user.

$$skip = 1 if $Transaction->Creator == $RT::SystemUser->id;
$Transaction => undef
$skip => undef

Sane template for your custom code Edit

  # do nothing if transaction is already flagged for skipping
  # yes, this is possible, you may have many callbacks that
  # skip using different conditions
  return if $$skip;
  # do nothing if it's not system user
  return unless $Transaction->Creator == $RT::SystemUser->id;
  # this is not good idea to skip some transaction types
  # even if those are created by system user
  return if $SHOW{ $Transaction->Type };
  here add your additional conditions
  my %SHOW = map { $_ => 1} qw(
      Create Comment Correspond
      EmailRecord CommentEmailRecord
  $Transaction => undef
  $skip => undef

Additional code snippets Edit

Do not hide on History.html page Edit

If you'd like to have an abbreviated history on the main ticket display, but would like the full history in the History tab display, then add the following:

  # do nothing if we're on history page
  return if $r->uri =~ /History\.html/;

RT::Extension::HistoryFilter Edit

I created an extension where you can define which transaction types are shown on the ticket display page. The ticket history page shows always the full history. You can find it at github:

See also Edit


Around Wikia's network

Random Wiki