[Rt-commit] rt branch, 4.4/recently-viewed-tickets-no-debug-message-for-shredded-tickets, updated. rt-4.4.4-13-ga4cb28d01
Michel Rodriguez
michel at bestpractical.com
Wed Apr 10 12:07:30 EDT 2019
The branch, 4.4/recently-viewed-tickets-no-debug-message-for-shredded-tickets has been updated
via a4cb28d0164af669bc84091a0bb9826a48eee7ca (commit)
from 4c55894d59ab5312534d572af1b1db2e76e2dc87 (commit)
Summary of changes:
lib/RT/Ticket.pm | 16 +++++++++++++++-
share/html/Elements/Tabs | 2 +-
2 files changed, 16 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit a4cb28d0164af669bc84091a0bb9826a48eee7ca
Author: michel <michel at bestpractical.com>
Date: Tue Apr 9 20:21:32 2019 +0200
do not emit debug message when a ticket is not found in the Recently Viewed list (if it has been shredded)
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 38708af5f..e9f3d0f84 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -146,7 +146,9 @@ sub Load {
my ($ticketid, $msg) = $self->LoadById( $id );
unless ( $self->Id ) {
- $RT::Logger->debug("$self tried to load a bogus ticket: $id");
+ $RT::Logger->debug("$self tried to load a bogus ticket: $id")
+ # no need to emit message if Non Existent Tickets are allowed
+ unless (caller(1))[3] =~ m{LoadAllowNonExistentTickets$};
return (undef);
}
@@ -165,6 +167,18 @@ sub Load {
return $self->Id;
}
+=head2 LoadAllowNonExistentTickets
+
+Same as Load, but allows non existent tickets (that have been shredded)
+Calls Load with the same parameters, Load will then not throw a debug message
+if the ticket does not exist.
+
+=cut
+
+sub LoadAllowNonExistentTickets {
+ my $self= shift;
+ return $self->Load( @_);
+}
=head2 Create (ARGS)
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 755c8d219..5b2aee250 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -607,7 +607,7 @@ my $build_main_nav = sub {
for ($session{CurrentUser}->RecentlyViewedTickets) {
my ($ticketId, $timestamp) = @$_;
my $ticket = RT::Ticket->new($session{CurrentUser});
- $ticket->Load($ticketId);
+ $ticket->LoadAllowNonExistentTickets($ticketId);
if ($ticket->Id) {
my $title = $ticket->Subject || loc("(No subject)");
if (length $title > 50) {
-----------------------------------------------------------------------
More information about the rt-commit
mailing list