[Bps-public-commit] rt-extension-nonwatcherrecipients branch add-html-content-option created. 1.02-4-gdaa721f
BPS Git Server
git at git.bestpractical.com
Wed Feb 16 22:07:30 UTC 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-nonwatcherrecipients".
The branch, add-html-content-option has been created
at daa721f25c1bf13941b373b8e1b4fb4469c6b4dd (commit)
- Log -----------------------------------------------------------------
commit daa721f25c1bf13941b373b8e1b4fb4469c6b4dd
Author: Brad Embree <brad at bestpractical.com>
Date: Wed Feb 16 13:50:55 2022 -0800
Update Module::Install
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 2dd9489..2889ece 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -9,7 +9,7 @@ no warnings 'once';
use Term::ANSIColor qw(:constants);
use Module::Install::Base;
use base 'Module::Install::Base';
-our $VERSION = '0.42';
+our $VERSION = '0.43';
use FindBin;
use File::Glob ();
@@ -134,7 +134,7 @@ lexicons ::
if( $extra_args->{'remove_files'} ){
$self->include('Module::Install::RTx::Remove');
our @remove_files;
- eval { require "etc/upgrade/remove_files" }
+ eval { require "./etc/upgrade/remove_files" }
or print "No remove file located, no files to remove\n";
$remove_files = join ",", map {"q(\$(DESTDIR)$plugin_path/$name/$_)"} @remove_files;
}
commit 7e6d994924bbfc4d629af95f785363b74c92758d
Author: Brad Embree <brad at bestpractical.com>
Date: Tue Feb 8 08:39:23 2022 -0800
Update POD
diff --git a/lib/RT/Extension/NonWatcherRecipients.pm b/lib/RT/Extension/NonWatcherRecipients.pm
index 92eef2f..859f8ca 100644
--- a/lib/RT/Extension/NonWatcherRecipients.pm
+++ b/lib/RT/Extension/NonWatcherRecipients.pm
@@ -33,6 +33,8 @@ so you know someone may need to be added:
If you want the person to see correspondence, you can click the link and add
them. If not, you can just ignore the message.
+You can choose between a text message or html formatted message.
+
=head1 INSTALLATION
=over
@@ -73,19 +75,25 @@ or add C<RT::Extension::NonWatcherRecipients> to your existing C<@Plugins> line.
=head1 USAGE
-If you run the C<make initdb> step, a new global template called
-C<NonWatcherRecipients Admin Correspondence> is installed on your system.
-You can then select this template for any scrips that use the
-standard C<Admin Correspondence> template. We recommend the
-C<Admin Correspondence> template because you'll need RT privileges
-to add the user to the ticket.
+If you run the C<make initdb> step, two new global templates called
+C<NonWatcherRecipients Admin Correspondence> and
+C<NonWatcherRecipients Admin Correspondence in HTML> are installed on your
+system. You can then select one of these templates for any scrips that use the
+standard C<Admin Correspondence> or C<Admin Correspondence in HTML> templates.
+We recommend the C<Admin Correspondence> templates because you'll need RT
+privileges to add the user to the ticket.
-You can also add this to existing templates by adding the following
-to any template:
+You can also add these to existing templates by adding the following
+to any template for the plain text version:
{ RT::Extension::NonWatcherRecipients->FindRecipients(
Transaction => $Transaction, Ticket => $Ticket ) }
+or adding the following for the html version:
+
+ { RT::Extension::NonWatcherRecipients->FindRecipients(
+ Transaction => $Transaction, Ticket => $Ticket, Format => 'text/html' ) }
+
As described below, this method returns a message which is then inserted into
your template. Look at the installed template for an example. You may also
call the method and use the returned string however you'd like.
@@ -98,8 +106,13 @@ Search headers for recipients not included as watchers on the ticket
and return a message to insert in the outgoing email to notify
participants.
-Takes: (Transaction => $Transaction, Ticket => $Ticket)
-These are the objects provided in the RT template.
+Takes:
+
+ (Transaction => $Transaction, Ticket => $Ticket, Format => 'text/html')
+
+Transaction and Ticket are the objects provided in the RT template.
+Format is an optional parameter that accepts either 'text/plain' or 'text/html'
+and defaults to 'text/plain' if not specified.
Returns: a message to insert in a template
commit 26d70c468ea048d89355df0ec3c9329a86b21722
Author: Brad Embree <brad at bestpractical.com>
Date: Tue Feb 8 08:17:13 2022 -0800
Add HTML template
diff --git a/etc/initialdata b/etc/initialdata
index 8d83fe1..39eabb2 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -1,8 +1,9 @@
- at Templates = {
- Queue => 0,
- Name => 'NonWatcherRecipients Admin Correspondence',
- Description => 'Note non-ticket-watchers receiving email on correspondence',
- Content => <<' TEMPLATE',
+ at Templates = (
+ {
+ Queue => 0,
+ Name => 'NonWatcherRecipients Admin Correspondence',
+ Description => 'Plain text note about non-ticket-watchers receiving email on correspondence',
+ Content => <<' TEMPLATE',
RT-Attach-Message: yes
<URL: {RT->Config->Get('WebURL')}Ticket/Display.html?id={$Ticket->id} >
@@ -10,4 +11,20 @@ RT-Attach-Message: yes
{ RT::Extension::NonWatcherRecipients->FindRecipients(Transaction => $Transaction, Ticket => $Ticket) }
{$Transaction->Content()}
TEMPLATE
-};
+ },
+ {
+ Queue => 0,
+ Name => 'NonWatcherRecipients Admin Correspondence in HTML',
+ Description => 'HTML note about non-ticket-watchers receiving email on correspondence',
+ Content => <<' TEMPLATE',
+RT-Attach-Message: yes
+Content-Type: text/html
+
+<p>Ticket URL: <a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}</a>
+<br />
+<br />
+{ RT::Extension::NonWatcherRecipients->FindRecipients(Transaction => $Transaction, Ticket => $Ticket, Format => 'text/html') }</p>
+{$Transaction->Content(Type => "text/html");}
+ TEMPLATE
+ }
+);
commit b8b138d8901b34f9de53b024e33f2ffcf0027a28
Author: Brad Embree <brad at bestpractical.com>
Date: Tue Feb 8 08:27:56 2022 -0800
Add Format parameter
Adding the Format parameter for use in html formatted admin correspondence
diff --git a/lib/RT/Extension/NonWatcherRecipients.pm b/lib/RT/Extension/NonWatcherRecipients.pm
index 6149bfa..92eef2f 100644
--- a/lib/RT/Extension/NonWatcherRecipients.pm
+++ b/lib/RT/Extension/NonWatcherRecipients.pm
@@ -107,9 +107,11 @@ Returns: a message to insert in a template
sub FindRecipients {
my $self = shift;
- my %args = @_;
+ my %args = ( Format => 'text/plain',
+ @_ );
my $Transaction = $args{Transaction};
my $Ticket = $args{Ticket};
+ my $Format = $args{Format};
my $recipients; # List of recipients
my $message = ""; # Message for template
@@ -125,27 +127,39 @@ sub FindRecipients {
my %addr = %{ $att->Addresses };
my $creator = $Transaction->CreatorObj->RealName || '';
+ my $newline = "\n";
+ if ( $Format eq 'text/html' ) {
+ $newline = "<br/>\n";
+ }
+
# Show any extra recipients
for my $hdr (qw(From To Cc RT-Send-Cc RT-Send-Bcc)) {
my @new = grep { not $self->IsWatcher($_->address, $Ticket) } @{$addr{$hdr} || []};
- $recipients .= " $hdr: " . $self->Format(\@new) . "\n"
+ $recipients .= " $hdr: " . $self->Format(\@new) . $newline
if @new;
}
-
if ($recipients) {
- $message = "The following people received a copy of this email "
- . "but are not on the ticket. You may want to add them "
- . "before replying: ${RT::WebURL}Ticket/ModifyPeople.html?id="
- . $Ticket->id . "\n\n$recipients";
+ my $href = "${RT::WebURL}Ticket/ModifyPeople.html?id=" . $Ticket->id;
+ if ( $Format eq 'text/html' ) {
+ $message = "The following people received a copy of this email "
+ . "but are not on the ticket. You may want to "
+ . '<a href="' . $href . '">add them</a> before replying.'
+ . "$newline$newline$recipients";
+ }
+ else {
+ $message = "The following people received a copy of this email "
+ . "but are not on the ticket. You may want to add them "
+ . "before replying: $href$newline$newline$recipients";
+ }
}
# Show From if there's a different phrase; this catches name changes and "via RT"
my @from = grep { ($_->phrase||'') ne $creator } @{$addr{From} || []};
- $message = " From: " . $self->Format(\@from) . ($message ? "\n\n$message" : "\n")
+ $message = " From: " . $self->Format(\@from) . ($message ? "$newline$newline$message" : $newline)
if @from;
if ($message) {
- my $sep = "-" x 72;
+ my $sep = $Format eq 'text/html' ? '<hr />' : "-" x 72;
$message = "$sep\n$message$sep\n";
}
-----------------------------------------------------------------------
hooks/post-receive
--
rt-extension-nonwatcherrecipients
More information about the Bps-public-commit
mailing list