Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Handle* methods for compatibility with RT 4.4
Email plugin handling for RT 4.4 was refactored, providing new HandleAction hooks rather than including all functionality in GetCurrentUser. Create a new Action module and provide Handle methods for the standard comment and correspond actions to allow users to upgrade in place. The updates allow the code to run for both RT 4.2 and 4.4 with minimal duplication. However the code is in a new module, so users will need to update their RT_SiteConfig.pm.
- Loading branch information
1 parent
a14e65a
commit 45bb68e
Showing
3 changed files
with
116 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm | ||
index 175805d..7ffba8e 100644 | ||
--- a/lib/RT/Interface/Email.pm | ||
+++ b/lib/RT/Interface/Email.pm | ||
@@ -248,6 +248,7 @@ sub Gateway { | ||
Action => $action, | ||
Subject => $Subject, | ||
Message => $Message, | ||
+ CurrentUser => $CurrentUser, | ||
Ticket => $Ticket, | ||
TicketId => $args{ticket}, | ||
Queue => $SystemQueueObj, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package RT::Interface::Email::Action::CommandByMail; | ||
|
||
use warnings; | ||
use strict; | ||
|
||
use Role::Basic 'with'; | ||
with 'RT::Interface::Email::Role'; | ||
|
||
=head1 NAME | ||
RT::Interface::Email::Action::CommandByMail - Change metadata of ticket via email | ||
=head1 DESCRIPTION | ||
This action provides compatibility with the new mail plugin system introduced | ||
in RT 4.4. It provides an alternate to the default comment and correspond | ||
handlers provided by RT. | ||
=cut | ||
|
||
# To maintain compatibility with previous versions of CommandByMail, | ||
# handle the standard comment and correspond actions. Follow the | ||
# pattern from RT's default action handling for providing both. | ||
|
||
sub HandleComment { | ||
_HandleEither( @_, Action => "Comment" ); | ||
} | ||
|
||
sub HandleCorrespond { | ||
_HandleEither( @_, Action => "Correspond" ); | ||
} | ||
|
||
sub _HandleEither { | ||
my %args = ( | ||
Action => undef, | ||
Message => undef, | ||
Subject => undef, | ||
Ticket => undef, | ||
TicketId => undef, | ||
Queue => undef, | ||
@_, | ||
); | ||
|
||
my $return_ref = RT::Extension::CommandByMail::ProcessCommands(%args); | ||
|
||
if ( exists $return_ref->{'MailError'} and $return_ref->{'MailError'} ){ | ||
MailError( | ||
Subject => $return_ref->{'ErrorSubject'}, | ||
Explanation => $return_ref->{'Explanation'}, | ||
FAILURE => $return_ref->{'Failure'}, | ||
); | ||
} | ||
return; | ||
} | ||
|
||
1; |