[Rt-commit] rt branch 5.0/dashboard-email-subject-method created. rt-5.0.5-167-g3049eada7a

BPS Git Server git at git.bestpractical.com
Fri Mar 22 15:41:42 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/dashboard-email-subject-method has been created
        at  3049eada7a6b829617d22d1da8643a0471eac0b8 (commit)

- Log -----------------------------------------------------------------
commit 3049eada7a6b829617d22d1da8643a0471eac0b8
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Fri Mar 22 11:36:34 2024 -0400

    Split dashboard email subject to a separate method
    
    Refactoring the code that generates the subject of a dashboard email
    into a separate method aids in the creation of extensions that allow for
    dashboard emails to be sent via 3rd party bulk emailing APIs and other
    email services.

diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 84ce29e171..31c8624bf7 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -479,22 +479,18 @@ sub ObsoleteSubscription {
     }
 }
 
-sub EmailDashboard {
+sub DashboardSubject {
     my $self = shift;
     my %args = (
         CurrentUser  => undef,
-        Email        => undef,
         Dashboard    => undef,
         Subscription => undef,
-        Content      => undef,
         @_,
     );
 
     my $subscription = $args{Subscription};
     my $dashboard    = $args{Dashboard};
     my $currentuser  = $args{CurrentUser};
-    my $email        = $args{Email};
-
     my $frequency    = $subscription->SubValue('Frequency');
 
     my %frequency_lookup = (
@@ -512,6 +508,31 @@ sub EmailDashboard {
         $currentuser->loc($frequency_display),
         $dashboard->Name;
 
+    return $subject;
+}
+
+sub EmailDashboard {
+    my $self = shift;
+    my %args = (
+        CurrentUser  => undef,
+        Email        => undef,
+        Dashboard    => undef,
+        Subscription => undef,
+        Content      => undef,
+        @_,
+    );
+
+    my $subscription = $args{Subscription};
+    my $dashboard    = $args{Dashboard};
+    my $currentuser  = $args{CurrentUser};
+    my $email        = $args{Email};
+
+    my $subject = $self->DashboardSubject(
+        CurrentUser  => $currentuser,
+        Dashboard    => $dashboard,
+        Subscription => $subscription,
+    );
+
     my $entity = $self->BuildEmail(
         %args,
         To      => $email,

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list