[Rt-commit] rt branch 4.4-trunk updated: Add --user to process dashboard subscriptions for a single user only
sunnavy
sunnavy at bestpractical.com
Thu Jul 8 08:56:19 EDT 2021
This is an automated email from the git hooks/post-receive script.
jbrandt pushed a commit to branch 4.4-trunk
in repository rt.
The following commit(s) were added to refs/heads/4.4-trunk by this push:
new ca398c02a2 Add --user to process dashboard subscriptions for a single user only
new eb4d6747ed Merge branch '4.4/email-dashboard-user-arg' into 4.4-trunk
ca398c02a2 is described below
commit ca398c02a2f576830a24e82144c7bfb81a0e3f9d
Author: sunnavy <sunnavy at bestpractical.com>
AuthorDate: Thu Jul 8 03:58:08 2021 +0800
Add --user to process dashboard subscriptions for a single user only
This can be helpful for debugging dashboard email for a
specific user.
---
lib/RT/Dashboard/Mailer.pm | 6 ++++++
sbin/rt-email-dashboards.in | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 53d4adf9b3..3770b1fe13 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -69,6 +69,7 @@ sub MailDashboards {
All => 0,
DryRun => 0,
Time => time,
+ User => undef,
@_,
);
@@ -81,6 +82,11 @@ sub MailDashboards {
my $Users = RT::Users->new(RT->SystemUser);
$Users->LimitToPrivileged;
$Users->LimitToEnabled;
+ if ( $args{User} ) {
+ my $user = RT::User->new( RT->SystemUser );
+ $user->Load( $args{User} );
+ $Users->Limit( FIELD => 'id', VALUE => $user->Id || 0 );
+ }
while (defined(my $user = $Users->Next)) {
my ($hour, $dow, $dom) = HourDowDomIn($args{Time}, $user->Timezone || RT->Config->Get('Timezone'));
diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index fb3eea7239..9f31804c4d 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -70,7 +70,7 @@ BEGIN { # BEGIN RT CMD BOILERPLATE
my %opts;
use Getopt::Long;
GetOptions( \%opts,
- "help|h", "dryrun", "time=i", "epoch=i", "all", "log=s"
+ "help|h", "dryrun", "time=i", "epoch=i", "all", "log=s", "user=s"
);
if ($opts{'help'}) {
@@ -97,6 +97,7 @@ RT::Dashboard::Mailer->MailDashboards(
All => $opts{all},
DryRun => $opts{dryrun},
Time => ($opts{time} || $opts{epoch} || time), # epoch is the old-style
+ User => $opts{user},
Opts => \%opts,
);
@@ -159,6 +160,10 @@ Back-compat for --time SECONDS.
Ignore subscription frequency when considering each dashboard (should only be
used with --dryrun for testing and debugging)
+=item --user User NAME or ID
+
+Only check the specified user's subscriptions
+
=item --log LEVEL
Adjust LogToSTDERR config option
--
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.
More information about the rt-commit
mailing list