[Rt-commit] rt branch, 4.4/disabled-user-dashboard-subscription, created. rt-4.4.3-56-g02fd04251
Jim Brandt
jbrandt at bestpractical.com
Thu Oct 4 11:01:26 EDT 2018
The branch, 4.4/disabled-user-dashboard-subscription has been created
at 02fd042514d42021bc2b615ccc4e1b402ed6d90b (commit)
- Log -----------------------------------------------------------------
commit 0093df241ab22330fcd3e62b70595b540c13f38e
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Oct 4 10:05:39 2018 -0400
Clarify email recipients in dryrun debug message
diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 20e206626..35b40cfa5 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -308,7 +308,8 @@ sub SendDashboard {
if ($args{DryRun}) {
print << "SUMMARY";
Dashboard: @{[ $dashboard->Name ]}
- User: @{[ $currentuser->Name ]} <$args{Email}>
+ Subscription Owner: @{[ $currentuser->Name ]}
+ Recipient: <$args{Email}>
SUMMARY
return;
}
commit c6263b270fbb8e55e13a2b0f42eb317132d54821
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Oct 4 10:32:18 2018 -0400
Tests for disabled users and groups in dashboard subscription UI
diff --git a/t/web/dashboards-subscription.t b/t/web/dashboards-subscription.t
index fadc254d4..8a3473e91 100644
--- a/t/web/dashboards-subscription.t
+++ b/t/web/dashboards-subscription.t
@@ -93,6 +93,13 @@ $m->content_contains('customer2 added to dashboard subscription recipients');
$m->follow_link_ok({ id => 'page-subscription' });
$m->content_contains('customer2 at example.com');
+# Disable user
+$search_user->SetDisabled(1);
+
+# Confirm they are not shown
+$m->follow_link_ok({ id => 'page-subscription' });
+$m->content_lacks('customer2 at example.com');
+
# Create new group to search for
my $search_group = RT::Group->new(RT->SystemUser);
($ret, $msg) = $search_group->CreateUserDefinedGroup(Name => 'customers test group');
@@ -115,6 +122,15 @@ $m->content_contains('customers test group added to dashboard subscription recip
$m->follow_link_ok({ id => 'page-subscription' });
$m->content_contains('customers test group');
+# Disable user
+$search_group->SetDisabled(1);
+
+# Confirm they are not shown
+$m->follow_link_ok({ id => 'page-subscription' });
+$m->content_lacks('customers test group');
+$search_group->SetDisabled(0);
+$m->follow_link_ok({ id => 'page-subscription' });
+
# Unsubscribe group
$m->form_name('SubscribeDashboard');
$m->untick("Dashboard-Subscription-Groups-".$search_group->id, 1);
commit b2839eb89e71eb02ba26c9234f9d2e7aeef6b720
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Oct 4 10:33:01 2018 -0400
Omit disabled users and groups from dashboard subscription page
diff --git a/share/html/Dashboards/Elements/SubscriptionRecipients b/share/html/Dashboards/Elements/SubscriptionRecipients
index eb42591d2..b7040eb33 100644
--- a/share/html/Dashboards/Elements/SubscriptionRecipients
+++ b/share/html/Dashboards/Elements/SubscriptionRecipients
@@ -183,7 +183,7 @@ if ($GroupString) {
% next if $user_id == $session{'CurrentUser'}->id; # already listed current user
% my $user = RT::User->new( $session{'CurrentUser'} );
% $user->Load($user_id);
-% next unless $user->id;
+% next unless $user->id and !$user->Disabled;
<li>
<input type="checkbox" class="checkbox" name="Dashboard-Subscription-Users-<%$user_id%>" value="1" checked />
<input type="hidden" name="Dashboard-Subscription-Users-<%$user_id%>" value="0" />
@@ -201,7 +201,7 @@ if ($GroupString) {
% for my $group_id (@{ $recipients_groups || [] }) {
% my $group = RT::Group->new( $session{'CurrentUser'} );
% $group->Load($group_id);
-% next unless $group->id;
+% next unless $group->id and !$group->Disabled;
<li>
<input type="checkbox" class="checkbox" name="Dashboard-Subscription-Groups-<%$group_id%>" value="1" checked />
<input type="hidden" name="Dashboard-Subscription-Groups-<%$group_id%>" value="0" />
commit a37bb650edb93863965eb78f7298fbfcb553f113
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Oct 4 10:58:10 2018 -0400
Exclude disabled users in initial query
diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 35b40cfa5..9d2f15059 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -80,13 +80,9 @@ sub MailDashboards {
# look through each user for her subscriptions
my $Users = RT::Users->new(RT->SystemUser);
$Users->LimitToPrivileged;
+ $Users->LimitToEnabled;
while (defined(my $user = $Users->Next)) {
- if ($user->PrincipalObj->Disabled) {
- $RT::Logger->debug("Skipping over " . $user->Name . " due to having a disabled account.");
- next;
- }
-
my ($hour, $dow, $dom) = HourDowDomIn($args{Time}, $user->Timezone || RT->Config->Get('Timezone'));
$hour .= ':00';
$RT::Logger->debug("Checking ".$user->Name."'s subscriptions: hour $hour, dow $dow, dom $dom");
commit 02fd042514d42021bc2b615ccc4e1b402ed6d90b
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Oct 4 10:59:21 2018 -0400
Skip disabled users when sending dashboard subscriptions
diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 9d2f15059..fb669745d 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -113,7 +113,7 @@ sub MailDashboards {
for my $user_id (@{ $recipients_users || [] }) {
my $user = RT::User->new(RT->SystemUser);
$user->Load($user_id);
- next unless $user->id;
+ next unless $user->id and !$user->Disabled;
push @emails, $user->EmailAddress;
$recipient_language{$user->EmailAddress} = $user->Lang;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list