[Bps-public-commit] RT-Extension-CommandByMail branch, master, updated. 2.00-3-gfbc862f
Jim Brandt
jbrandt at bestpractical.com
Mon Apr 11 15:08:09 EDT 2016
The branch, master has been updated
via fbc862fca9d8792fa2a2c36bbc151869abe91e6c (commit)
via 76aede2a7babf1756beee93d66801890e35e6ff5 (commit)
via 9ddabe36973ca2ae022f9459865e2f113ec289b4 (commit)
from df51ef394b08725726d857898cd3f694c12a1fa6 (commit)
Summary of changes:
Changes | 4 ++++
META.yml | 2 +-
README | 6 ++++++
lib/RT/Extension/CommandByMail.pm | 36 ++++++++++++++++++++++++++++++++++--
xt/create.t | 17 +++++++++++++++++
5 files changed, 62 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 9ddabe36973ca2ae022f9459865e2f113ec289b4
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Apr 11 14:51:12 2016 -0400
Test showing error on create with ParseNewMessageForTicketCcs set
diff --git a/xt/create.t b/xt/create.t
index 83b568f..150460b 100644
--- a/xt/create.t
+++ b/xt/create.t
@@ -362,4 +362,21 @@ END
}
+RT::Config->Set('ParseNewMessageForTicketCcs', 1);
+diag("test with ParseNewMessageForTicketCcs set") if $ENV{'TEST_VERBOSE'};
+{
+ my $text = <<END;
+Subject: test
+From: root\@localhost
+
+test
+END
+ my (undef, $id) = $test->send_via_mailgate( $text );
+ ok($id, "created ticket");
+ my $obj = RT::Ticket->new( $RT::SystemUser );
+ $obj->Load( $id );
+ is($obj->id, $id, "loaded ticket");
+ $test_ticket_id = $id;
+}
+
done_testing();
commit 76aede2a7babf1756beee93d66801890e35e6ff5
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Apr 11 14:57:43 2016 -0400
Recreate ParseCcAddressesFromHead for local usage
ParseCcAddressesFromHead previously was provided in RT
but was removed in the refactoring for the new email
plugin model. It's still useful in the context of new email
processing here, specifically when ParseNewMessageForTicketCcs
is set, so recreate a version locally.
diff --git a/README b/README
index 177138a..b2bfcdf 100644
--- a/README
+++ b/README
@@ -205,6 +205,12 @@ METHODS
The return values coexist and unused values are ignored by the different
versions.
+ ParseCcAddressesFromHead HASH
+ Takes a hash containing QueueObj, Head and CurrentUser objects. Returns
+ a list of all email addresses in the To and Cc headers b<except> the
+ current Queue's email addresses, the CurrentUser's email address and
+ anything that the configuration sub RT::IsRTAddress matches.
+
AUTHOR
Best Practical Solutions, LLC <modules at bestpractical.com>
diff --git a/lib/RT/Extension/CommandByMail.pm b/lib/RT/Extension/CommandByMail.pm
index 5f02a6f..0a0b823 100644
--- a/lib/RT/Extension/CommandByMail.pm
+++ b/lib/RT/Extension/CommandByMail.pm
@@ -1,7 +1,8 @@
use 5.10.1;
package RT::Extension::CommandByMail;
-use RT::Interface::Email qw(ParseCcAddressesFromHead);
+use RT::EmailParser;
+use Email::Address;
our @REGULAR_ATTRIBUTES = qw(Queue Owner Subject Status Priority FinalPriority);
our @TIME_ATTRIBUTES = qw(TimeWorked TimeLeft TimeEstimated);
@@ -902,6 +903,37 @@ sub _ReportResults {
return;
}
+=head2 ParseCcAddressesFromHead HASH
+
+Takes a hash containing QueueObj, Head and CurrentUser objects.
+Returns a list of all email addresses in the To and Cc
+headers b<except> the current Queue's email addresses, the CurrentUser's
+email address and anything that the configuration sub RT::IsRTAddress matches.
+
+=cut
+
+# Originally part of RT, this function was refactored into core 'create'
+# functionality in 4.4 via 5ccf5a14f. It's still useful in the logic flow
+# here, so reproduce the old function.
+
+sub ParseCcAddressesFromHead {
+ my %args = (
+ Head => undef,
+ QueueObj => undef,
+ CurrentUser => undef,
+ @_
+ );
+
+ my $current_address = lc $args{'CurrentUser'}->EmailAddress;
+ my $user = $args{'CurrentUser'}->UserObj;
+
+ return
+ grep $_ ne $current_address && !RT::EmailParser->IsRTAddress( $_ ),
+ map lc $user->CanonicalizeEmailAddress( $_->address ),
+ map RT::EmailParser->CleanupAddresses( Email::Address->parse(
+ Encode::decode( "UTF-8", $args{'Head'}->get( $_ ) ) ) ),
+ qw(To Cc);
+}
1;
__END__
commit fbc862fca9d8792fa2a2c36bbc151869abe91e6c
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Apr 11 15:01:00 2016 -0400
Prep for version 2.01
diff --git a/Changes b/Changes
index 22468d0..f60c7a9 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,7 @@
+2.01 2016-04-11
+ - Recreate ParseCcAddressesFromHead to support create with
+ ParseNewMessageForTicketCcs set
+
2.00 2016-03-29
- Refactor to add support for RT 4.4
- Update docs to clarify header handling
diff --git a/META.yml b/META.yml
index e45f323..eab7825 100644
--- a/META.yml
+++ b/META.yml
@@ -27,6 +27,6 @@ requires:
perl: 5.10.1
resources:
license: http://opensource.org/licenses/gpl-license.php
-version: '2.00'
+version: '2.01'
x_module_install_rtx_version: '0.37'
x_requires_rt: 4.0.0
diff --git a/lib/RT/Extension/CommandByMail.pm b/lib/RT/Extension/CommandByMail.pm
index 0a0b823..cf0e04e 100644
--- a/lib/RT/Extension/CommandByMail.pm
+++ b/lib/RT/Extension/CommandByMail.pm
@@ -11,7 +11,7 @@ our @LINK_ATTRIBUTES = qw(MemberOf Parents Members Children
HasMember RefersTo ReferredToBy DependsOn DependedOnBy);
our @WATCHER_ATTRIBUTES = qw(Requestor Cc AdminCc);
-our $VERSION = '2.00';
+our $VERSION = '2.01';
=head1 NAME
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list