[Bps-public-commit] rt-extension-excelfeed branch, master, updated. 0.04-2-gd252fe2

? sunnavy sunnavy at bestpractical.com
Wed Sep 19 10:26:57 EDT 2018


The branch, master has been updated
       via  d252fe24c47608972660c6665d5ffbdbc31f143d (commit)
      from  c6a35c95a8b9432317ce716f18b836850f974152 (commit)

Summary of changes:
 lib/RT/Dashboard/Mailer_Vendor.pm | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit d252fe24c47608972660c6665d5ffbdbc31f143d
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Wed Sep 19 22:24:05 2018 +0800

    Respect SuppressIfEmpty config

diff --git a/lib/RT/Dashboard/Mailer_Vendor.pm b/lib/RT/Dashboard/Mailer_Vendor.pm
index 0204c83..09a8875 100644
--- a/lib/RT/Dashboard/Mailer_Vendor.pm
+++ b/lib/RT/Dashboard/Mailer_Vendor.pm
@@ -95,7 +95,24 @@ SUMMARY
     local $HTML::Mason::Commands::session{CurrentUser} = $currentuser;
     local $HTML::Mason::Commands::r = RT::Dashboard::FakeRequest->new;
 
-    my $content;
+    my $HasResults = undef;
+
+    my $content = RunComponent(
+        '/Dashboards/Render.html',
+        id         => $dashboard->Id,
+        Preview    => 0,
+        HasResults => \$HasResults,
+    );
+
+    if ($subscription->SubValue('SuppressIfEmpty')) {
+        # undef means there were no searches, so we should still send it (it's just portlets)
+        # 0 means there was at least one search and none had any result, so we should suppress it
+        if (defined($HasResults) && !$HasResults) {
+            $RT::Logger->debug("Not sending because there are no results and the subscription has SuppressIfEmpty");
+            return;
+        }
+    }
+
     my @attachments;
     my $send_msexcel = $subscription->SubValue('MSExcel');
 
@@ -135,13 +152,6 @@ SUMMARY
         }
     }
     else{
-        # Process standard inline dashboard
-        $content = RunComponent(
-            '/Dashboards/Render.html',
-            id      => $dashboard->Id,
-            Preview => 0,
-        );
-
         if ( RT->Config->Get('EmailDashboardRemove') ) {
             for ( RT->Config->Get('EmailDashboardRemove') ) {
                 $content =~ s/$_//g;

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


More information about the Bps-public-commit mailing list