[Bps-public-commit] rt-extension-text-messages branch, master, updated. 8542b18e1be6a045a1b797ab3c01f05d7dcb53f2

Craig Kaiser craig at bestpractical.com
Fri Jun 22 10:20:49 EDT 2018


The branch, master has been updated
       via  8542b18e1be6a045a1b797ab3c01f05d7dcb53f2 (commit)
       via  0f8354210b6792abb30a678223b69571f937eca8 (commit)
       via  06414e900c94adc32a645b15a7a1491922bee3b4 (commit)
      from  f4996da48ca85a8adc2ec8dea2c97779464aa1e0 (commit)

Summary of changes:
 lib/RT/Action/NotifyMessage.pm    | 56 ---------------------------------------
 lib/RT/Action/NotifySMS.pm        |  9 +++++--
 lib/RT/Action/NotifyTwilio.pm     |  6 -----
 lib/RT/Extension/Text/Messages.pm |  4 +++
 4 files changed, 11 insertions(+), 64 deletions(-)
 delete mode 100644 lib/RT/Action/NotifyMessage.pm

- Log -----------------------------------------------------------------
commit 06414e900c94adc32a645b15a7a1491922bee3b4
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Fri Jun 22 09:56:41 2018 -0400

    Change NotifyMessage to NotifySMS

diff --git a/lib/RT/Action/NotifyMessage.pm b/lib/RT/Action/NotifyMessage.pm
deleted file mode 100644
index 50c2b6a..0000000
--- a/lib/RT/Action/NotifyMessage.pm
+++ /dev/null
@@ -1,56 +0,0 @@
-package RT::Action::NotifyMessage;
-
-use base qw(RT::Action);
-
-use strict;
-use warnings;
-use LWP::UserAgent;
-
-my @roles = RT::Config->Get('MessageRoles');
-my @recipients;
-
-sub Prepare {
-    my $self = shift;
-
-    my ( $ret, $msg ) = $self->SetRecipients;
-    return ( $ret, $msg ) unless $ret;
-
-    return 1;
-}
-
-sub Commit {
-    my $self = shift;
-
-    my ( $ret, $msg ) = $self->ScripActionObj->Action->SendMessage(
-        Recipients => \@recipients,
-        Msg        => $self->TicketObj->Subject,
-    );
-
-    RT::Logger->error($msg) unless $ret;
-
-    return $ret;
-}
-
-sub SetRecipients {
-    my $self = shift;
-
-    my $ticketObj = $self->TicketObj;
-
-    foreach my $role (@roles) {
-        my $groups = $ticketObj->$role->GroupMembersObj( Recursively => 1 );
-        while ( my $group = $groups->Next ) {
-            my $UserMembersObj = $group->UserMembersObj;
-            while ( my $user = $UserMembersObj->Next ) {
-                push @recipients, $user->MobilePhone
-                    unless !$user->MobilePhone;
-            }
-        }
-    }
-
-    return ( 0, 'No users provided to send message to' )
-        unless scalar @recipients;
-
-    return ( 1, 'Recipients set' );
-}
-
-1;
diff --git a/lib/RT/Action/NotifySMS.pm b/lib/RT/Action/NotifySMS.pm
index 305d7e4..6dae666 100644
--- a/lib/RT/Action/NotifySMS.pm
+++ b/lib/RT/Action/NotifySMS.pm
@@ -172,10 +172,15 @@ sub SetRecipients {
         }
     }
 
-    my @roles = \@To, \@Cc, \@Bcc, \@PseudoTo;
+    my @roles = \@To;
+    push @roles, \@Cc;
+    push @roles, \@Bcc;
+    push @roles, \@PseudoTo;
+
     my $user = RT::User->new( RT->SystemUser );
     my @recipients;
-
+    use Data::Printer;
+    p(@roles);
     foreach my $role (@roles) {
         foreach my $user_email ( @{$role} ) {
             my ( $ret, $msg ) = $user->LoadByEmail($user_email);

commit 0f8354210b6792abb30a678223b69571f937eca8
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Fri Jun 22 09:56:59 2018 -0400

    Remove debug code from NotifyTwilio action

diff --git a/lib/RT/Action/NotifyTwilio.pm b/lib/RT/Action/NotifyTwilio.pm
index 7635a51..5cd6dd7 100644
--- a/lib/RT/Action/NotifyTwilio.pm
+++ b/lib/RT/Action/NotifyTwilio.pm
@@ -29,12 +29,6 @@ sub SendMessage {
         @_
     );
 
-<<<<<<< HEAD
-    use Data::Printer;
-    p(%args);
-
-=======
->>>>>>> cc6e43c... Add custom notify action modules
     foreach my $config (
         qw /TwilioAccounId TwilioAuthToken APIDomain APIRealm MessageSender/)
     {

commit 8542b18e1be6a045a1b797ab3c01f05d7dcb53f2
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Fri Jun 22 09:57:51 2018 -0400

    Add README notes

diff --git a/lib/RT/Extension/Text/Messages.pm b/lib/RT/Extension/Text/Messages.pm
index 7101047..5aa4c1d 100644
--- a/lib/RT/Extension/Text/Messages.pm
+++ b/lib/RT/Extension/Text/Messages.pm
@@ -20,6 +20,10 @@ where the action module is one of the notify option from this extension:
 
 "NotifyTwilio"
 
+For the action you can choose to pass the following parameters:
+
+All, Owner, Requestor, AdminCc, Cc
+
 =head1 RT VERSION
 
 Works with RT 4.4.0

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list