[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.6-224-g58bc34f
Shawn Moore
sartak at bestpractical.com
Mon Nov 29 20:36:36 EST 2010
The branch, 3.9-trunk has been updated
via 58bc34ff644fb6e94e1b0afc609ed9bf6e0b6b30 (commit)
from 8897ee388a32bc26ae8bd708e508ec071faea0ce (commit)
Summary of changes:
lib/RT/Dashboard/Mailer.pm | 63 +++++++++++++++++++++++++++----------------
1 files changed, 39 insertions(+), 24 deletions(-)
- Log -----------------------------------------------------------------
commit 58bc34ff644fb6e94e1b0afc609ed9bf6e0b6b30
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon Nov 29 20:36:19 2010 -0500
Factor out an ObsoleteSubscription method
diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 7ebd9d5..e4a0aaa 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -181,31 +181,10 @@ sub SendDashboard {
# failed to load dashboard. perhaps it was deleted or it changed privacy
if (!$ok) {
$RT::Logger->warning("Unable to load dashboard $DashboardId of subscription ".$subscription->Id." for user ".$currentuser->Name.": $msg");
-
- my $ok = RT::Interface::Email::SendEmailUsingTemplate(
- From => $args{From},
- To => $args{Email},
- Template => 'Error: Missing dashboard',
- Arguments => {
- SubscriptionObj => $subscription,
- },
+ return $self->ObsoleteSubscription(
+ %args,
+ Subscription => $subscription,
);
-
- # only delete the subscription if the email looks like it went through
- if ($ok) {
- my ($deleted, $msg) = $subscription->Delete();
- if ($deleted) {
- $RT::Logger->info("Deleted an obsolete subscription: $msg");
- }
- else {
- $RT::Logger->warning("Unable to delete an obsolete subscription: $msg");
- }
- }
- else {
- $RT::Logger->warning("Unable to notify ".$currentuser->Name." of an obsolete subscription");
- }
-
- return;
}
$RT::Logger->info('Generating dashboard "'.$dashboard->Name.'" for user "'.$currentuser->Name.'":');
@@ -247,6 +226,42 @@ SUMMARY
);
}
+sub ObsoleteSubscription {
+ my $self = shift;
+ my %args = (
+ From => undef,
+ To => undef,
+ Subscription => undef,
+ CurrentUser => undef,
+ @_,
+ );
+
+ my $subscription = $args{Subscription};
+
+ my $ok = RT::Interface::Email::SendEmailUsingTemplate(
+ From => $args{From},
+ To => $args{Email},
+ Template => 'Error: Missing dashboard',
+ Arguments => {
+ SubscriptionObj => $subscription,
+ },
+ );
+
+ # only delete the subscription if the email looks like it went through
+ if ($ok) {
+ my ($deleted, $msg) = $subscription->Delete();
+ if ($deleted) {
+ $RT::Logger->info("Deleted an obsolete subscription: $msg");
+ }
+ else {
+ $RT::Logger->warning("Unable to delete an obsolete subscription: $msg");
+ }
+ }
+ else {
+ $RT::Logger->warning("Unable to notify ".$args{CurrentUser}->Name." of an obsolete subscription");
+ }
+}
+
sub EmailDashboard {
my $self = shift;
my %args = (
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list