[Rt-commit] rt branch 5.0/uninitialized-action-sendemail created. rt-5.0.5-149-g19680f70a5
BPS Git Server
git at git.bestpractical.com
Mon Jan 29 15:15:57 UTC 2024
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/uninitialized-action-sendemail has been created
at 19680f70a5273eeff8fd0451292dbd6b2d68184b (commit)
- Log -----------------------------------------------------------------
commit 19680f70a5273eeff8fd0451292dbd6b2d68184b
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Jan 29 09:35:21 2024 -0500
Quiet undefined warnings when sending rt-crontool email
When running in rt-crontool, the scrip and scrip action
objects are "void" and don't have ids. This can cause
undefined value warnings in logs when sending email for
automated rt-crontool jobs. Check for values and default to
zero if they are undefined.
diff --git a/lib/RT/Action/SendEmail.pm b/lib/RT/Action/SendEmail.pm
index 02df3d94f9..2755d83d68 100644
--- a/lib/RT/Action/SendEmail.pm
+++ b/lib/RT/Action/SendEmail.pm
@@ -1144,11 +1144,17 @@ sub SetReferencesHeaders {
# Make all references which are internal be to version which we
# have sent out
+ # In some contexts, like rt-crontool, ScripObj and ScripActionObj
+ # may be any empty object, so id is not defined.
+ my $scrip_obj_id = defined $self->ScripObj->id ? $self->ScripObj->id : 0;
+ my $scrip_action_obj_msg_id =
+ defined $self->ScripActionObj->{_Message_ID} ? $self->ScripActionObj->{_Message_ID} : 0;
+
for ( @references, @in_reply_to ) {
s/<(rt-.*?-\d+-\d+)\.(\d+-0-0)\@\Q$org\E>$/
"<$1." . $self->TicketObj->id .
- "-" . $self->ScripObj->id .
- "-" . $self->ScripActionObj->{_Message_ID} .
+ "-" . $scrip_obj_id .
+ "-" . $scrip_action_obj_msg_id .
"@" . $org . ">"/eg
}
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list