[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.0-37-g2682b0d
Shawn Moore
shawn at bestpractical.com
Fri Feb 12 13:40:18 EST 2016
The branch, 4.4-trunk has been updated
via 2682b0dec85152c693e99c7e3e6bcdbdb0e61183 (commit)
from 2f1feaa590b6bb133b5af6d7fc600a2770152d6f (commit)
Summary of changes:
lib/RT/Dashboard/Mailer.pm | 12 +--
.../html/Dashboards/Elements/ShowPortlet/dashboard | 14 ++--
share/html/Dashboards/Elements/ShowPortlet/search | 6 +-
share/html/Dashboards/Render.html | 14 ++--
share/html/Dashboards/Subscription.html | 7 --
share/html/Elements/CollectionList | 3 -
share/html/Elements/ShowSearch | 5 +-
t/mail/dashboard-empty.t | 88 ----------------------
8 files changed, 18 insertions(+), 131 deletions(-)
delete mode 100644 t/mail/dashboard-empty.t
- Log -----------------------------------------------------------------
commit 2682b0dec85152c693e99c7e3e6bcdbdb0e61183
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Fri Feb 12 13:39:50 2016 -0500
Revert "Let users choose to suppress dashboards with no results"
This reverts commit e8d0b19ee69c0cd7be7486a418587cd671e9b24a.
This work is incomplete and was merged by accident.
diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 88e90b9..f01576b 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -272,20 +272,12 @@ SUMMARY
local $HTML::Mason::Commands::session{CurrentUser} = $currentuser;
local $HTML::Mason::Commands::r = RT::Dashboard::FakeRequest->new;
- my $HasResults = 0;
-
my $content = RunComponent(
'/Dashboards/Render.html',
- id => $dashboard->Id,
- Preview => 0,
- HasResults => \$HasResults,
+ id => $dashboard->Id,
+ Preview => 0,
);
- if ($subscription->SubValue('SuppressIfEmpty') && !$HasResults) {
- $RT::Logger->debug("Not sending because there are no results and the subscription has SuppressIfEmpty");
- return;
- }
-
if ( RT->Config->Get('EmailDashboardRemove') ) {
for ( RT->Config->Get('EmailDashboardRemove') ) {
$content =~ s/$_//g;
diff --git a/share/html/Dashboards/Elements/ShowPortlet/dashboard b/share/html/Dashboards/Elements/ShowPortlet/dashboard
index f3f8513..d9f388e 100644
--- a/share/html/Dashboards/Elements/ShowPortlet/dashboard
+++ b/share/html/Dashboards/Elements/ShowPortlet/dashboard
@@ -52,7 +52,6 @@ $Portlet
$Rows => 20
$Preview => 0
$Depth => 0
-$HasResults
</%args>
<%init>
my $current_dashboard;
@@ -77,13 +76,12 @@ Abort("Possible recursive dashboard detected.") if $Depth > 8;
<%perl>
for my $portlet (@panes) {
$m->comp($portlet->{portlet_type},
- Portlet => $portlet,
- Rows => $Rows,
- Preview => $Preview,
- Dashboard => $current_dashboard,
- Pane => $Pane,
- Depth => $Depth + 1,
- HasResults => $HasResults
+ Portlet => $portlet,
+ Rows => $Rows,
+ Preview => $Preview,
+ Dashboard => $current_dashboard,
+ Pane => $Pane,
+ Depth => $Depth + 1,
);
}
</%perl>
diff --git a/share/html/Dashboards/Elements/ShowPortlet/search b/share/html/Dashboards/Elements/ShowPortlet/search
index 2198abd..4cf73d0 100644
--- a/share/html/Dashboards/Elements/ShowPortlet/search
+++ b/share/html/Dashboards/Elements/ShowPortlet/search
@@ -50,7 +50,6 @@ $Dashboard
$Portlet
$Rows => 20
$Preview => 0
-$HasResults
</%args>
<%init>
my @for_showsearch = $Dashboard->ShowSearchName($Portlet);
@@ -58,8 +57,7 @@ my @for_showsearch = $Dashboard->ShowSearchName($Portlet);
<& /Elements/ShowSearch,
@for_showsearch,
- Override => { Rows => $Rows },
- hideable => $Preview,
+ Override => { Rows => $Rows },
+ hideable => $Preview,
ShowCustomize => $Preview,
- HasResults => $HasResults,
&>
diff --git a/share/html/Dashboards/Render.html b/share/html/Dashboards/Render.html
index 294373e..93eaa3e 100644
--- a/share/html/Dashboards/Render.html
+++ b/share/html/Dashboards/Render.html
@@ -122,13 +122,12 @@ my $title = loc '[_1] Dashboard', $Dashboard->Name;
my $show_cb = sub {
my $pane = shift;
$m->comp('Elements/ShowPortlet/dashboard',
- Portlet => $Dashboard,
- Rows => $rows,
- Preview => $Preview,
- Dashboard => $Dashboard,
- Pane => $pane,
- Depth => 0,
- HasResults => $HasResults,
+ Portlet => $Dashboard,
+ Rows => $rows,
+ Preview => $Preview,
+ Dashboard => $Dashboard,
+ Pane => $pane,
+ Depth => 0,
);
};
@@ -141,6 +140,5 @@ my $Refresh = $Preview
<%ARGS>
$id => undef
$Preview => 1
-$HasResults => undef
</%ARGS>
diff --git a/share/html/Dashboards/Subscription.html b/share/html/Dashboards/Subscription.html
index 61d38cc..81db231 100644
--- a/share/html/Dashboards/Subscription.html
+++ b/share/html/Dashboards/Subscription.html
@@ -173,12 +173,6 @@
% }
</select>
</td></tr>
-
-<tr><td align="right"><input type="checkbox" id="SuppressIfEmpty" name="SuppressIfEmpty" value="1" <% $fields{'SuppressIfEmpty'} ? 'checked="checked"' : "" |n %> /></td>
-<td><label for="SuppressIfEmpty"><&|/l&>Suppress if empty (Check this to avoid sending mail if all searches have no results)</&></label><br />
-<input type="hidden"class="hidden" name="SuppressIfEmpty-Magic" value=1 />
-</td></tr>
-
</table>
</&>
@@ -234,7 +228,6 @@ my %fields = (
Recipients => { Users => [], Groups => [] },
Fow => 1,
Counter => 0,
- SuppressIfEmpty => 0,
);
# update any fields with the values from the subscription object
diff --git a/share/html/Elements/CollectionList b/share/html/Elements/CollectionList
index 989dd86..b8ef613 100644
--- a/share/html/Elements/CollectionList
+++ b/share/html/Elements/CollectionList
@@ -159,8 +159,6 @@ while ( my $record = $Collection->Next ) {
Warning => $warning,
Classes => $Classes,
);
-
- $$HasResults++ if $HasResults;
}
$m->out('</table>');
@@ -204,5 +202,4 @@ $ShowNavigation => 1
$ShowHeader => 1
$ShowEmpty => 0
$Query => 0
-$HasResults => undef
</%ARGS>
diff --git a/share/html/Elements/ShowSearch b/share/html/Elements/ShowSearch
index c154bca..9e6b79b 100644
--- a/share/html/Elements/ShowSearch
+++ b/share/html/Elements/ShowSearch
@@ -51,7 +51,7 @@
titleright => $customize ? loc('Edit') : '',
titleright_href => $customize,
hideable => $hideable &>
-<& $query_display_component, hideable => $hideable, %$ProcessedSearchArg, ShowNavigation => 0, Class => 'RT::Tickets', HasResults => $HasResults &>
+<& $query_display_component, hideable => $hideable, %$ProcessedSearchArg, ShowNavigation => 0, Class => 'RT::Tickets' &>
</&>
<%init>
my $search;
@@ -135,6 +135,5 @@ $SavedSearch => undef
%Override => ()
$IgnoreMissing => undef
$hideable => 1
-$ShowCustomize => 1
-$HasResults => undef
+$ShowCustomize => 1
</%ARGS>
diff --git a/t/mail/dashboard-empty.t b/t/mail/dashboard-empty.t
deleted file mode 100644
index 9e80e75..0000000
--- a/t/mail/dashboard-empty.t
+++ /dev/null
@@ -1,88 +0,0 @@
-use strict;
-use warnings;
-
-use RT::Test tests => undef;
-use RT::Dashboard::Mailer;
-
-my $root = RT::Test->load_or_create_user( Name => 'root' );
-
-my ( $baseurl, $m ) = RT::Test->started_ok;
-ok( $m->login, 'logged in' );
-
-sub create_dashboard {
- my ($name, $suppress_if_empty) = @_;
-
- # first, create and populate a "suppress if empty" dashboard
- $m->get_ok('/Dashboards/Modify.html?Create=1');
- $m->form_name('ModifyDashboard');
- $m->field( 'Name' => $name );
- $m->click_button( value => 'Create' );
-
- $m->follow_link_ok( { text => 'Content' } );
- my $form = $m->form_name('Dashboard-Searches-body');
- my @input = $form->find_input('Searches-body-Available');
-
- my ($dashboards_component) =
- map { ( $_->possible_values )[1] }
- grep { ( $_->value_names )[1] =~ /My Tickets/ } @input;
- $form->value( 'Searches-body-Available' => $dashboards_component );
- $m->click_button( name => 'add' );
- $m->content_contains('Dashboard updated');
-
- $m->follow_link_ok( { text => 'Subscription' } );
- $m->form_name('SubscribeDashboard');
- $m->field( 'Frequency' => 'daily' );
- $m->field( 'Hour' => '06:00' );
-
- $m->field( 'SuppressIfEmpty' => 1 ) if $suppress_if_empty;
-
- $m->click_button( name => 'Save' );
- $m->content_contains("Subscribed to dashboard $name");
-}
-
-create_dashboard('Suppress if empty', 1);
-
-diag 'no mail since the dashboard is suppressed if empty' if $ENV{'TEST_VERBOSE'};
-{
- RT::Dashboard::Mailer->MailDashboards(All => 1);
-
- my @mails = RT::Test->fetch_caught_mails;
- is @mails, 0, "got no dashboard mail because the dashboard is empty";
-}
-
-create_dashboard('Always send', 0);
-
-diag 'one mail since one of two dashboards is suppressed if empty' if $ENV{'TEST_VERBOSE'};
-{
- RT::Dashboard::Mailer->MailDashboards(All => 1);
-
- my @mails = RT::Test->fetch_caught_mails;
- is @mails, 1, "got a dashboard mail from the always-send dashboard";
- my $content = parse_mail( $mails[0] )->bodyhandle->as_string;
- like($content, qr/highest priority tickets I own/);
-}
-
-RT::Test->create_ticket(
- Queue => 'General',
- Subject => 'a search result!',
- Owner => $root,
-);
-RT::Test->fetch_caught_mails; # dump ticket notifications
-
-diag 'two mails since both dashboards now have results' if $ENV{'TEST_VERBOSE'};
-{
- RT::Dashboard::Mailer->MailDashboards(All => 1);
-
- my @mails = RT::Test->fetch_caught_mails;
- is @mails, 2, "got a dashboard mail from the always-send dashboard";
-
- for my $mail (@mails) {
- my $content = parse_mail( $mail )->bodyhandle->as_string;
- like($content, qr/highest priority tickets I own/);
- like($content, qr/a search result!/);
- }
-}
-
-undef $m;
-done_testing;
-
-----------------------------------------------------------------------
More information about the rt-commit
mailing list