[Bps-public-commit] rt-extension-excelfeed branch, user-context-cfs, created. 0.05-1-g8112d87

Jim Brandt jbrandt at bestpractical.com
Tue Sep 3 17:19:08 EDT 2019


The branch, user-context-cfs has been created
        at  8112d879674d85682184d8e1b7f5a56462d44fef (commit)

- Log -----------------------------------------------------------------
commit 8112d879674d85682184d8e1b7f5a56462d44fef
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Tue Sep 3 17:18:51 2019 -0400

    Update dashboard mailer with user context changes

diff --git a/lib/RT/Dashboard/Mailer_Vendor.pm b/lib/RT/Dashboard/Mailer_Vendor.pm
index 09a8875..5766c70 100644
--- a/lib/RT/Dashboard/Mailer_Vendor.pm
+++ b/lib/RT/Dashboard/Mailer_Vendor.pm
@@ -57,6 +57,7 @@ sub SendDashboard {
     my $self = shift;
     my %args = (
         CurrentUser  => undef,
+        ContextUser  => undef,
         Email        => undef,
         Subscription => undef,
         DryRun       => 0,
@@ -64,8 +65,8 @@ sub SendDashboard {
     );
 
     my $currentuser  = $args{CurrentUser};
+    my $context_user = $args{ContextUser} || $currentuser;
     my $subscription = $args{Subscription};
-
     my $rows = $subscription->SubValue('Rows');
 
     my $DashboardId = $subscription->SubValue('DashboardId');
@@ -82,17 +83,19 @@ sub SendDashboard {
         );
     }
 
-    $RT::Logger->debug('Generating dashboard "'.$dashboard->Name.'" for user "'.$currentuser->Name.'":');
+    $RT::Logger->debug('Generating dashboard "'.$dashboard->Name.'" for user "'.$context_user->Name.'":');
 
     if ($args{DryRun}) {
         print << "SUMMARY";
     Dashboard: @{[ $dashboard->Name ]}
-    User:   @{[ $currentuser->Name ]} <$args{Email}>
+    Subscription Owner: @{[ $currentuser->Name ]}
+    Recipient: <$args{Email}>
 SUMMARY
         return;
     }
 
     local $HTML::Mason::Commands::session{CurrentUser} = $currentuser;
+    local $HTML::Mason::Commands::session{ContextUser} = $context_user;
     local $HTML::Mason::Commands::r = RT::Dashboard::FakeRequest->new;
 
     my $HasResults = undef;

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list