[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.2-31-gfa9291e

Shawn Moore shawn at bestpractical.com
Thu Aug 17 15:53:29 EDT 2017


The branch, 4.4-trunk has been updated
       via  fa9291e64823b4a8cd05addd89e4225285853be7 (commit)
       via  b8e3cccc5dfde30af4fc57ca781fa6ce330496c8 (commit)
       via  913185b43ba7df8a52ae186d27b3bd99f8b5909d (commit)
      from  cfe20af20d93be5a6ba024fc556dcc7b958ff0cb (commit)

Summary of changes:
 lib/RT/Ticket.pm |  5 +++++
 t/ticket/merge.t | 40 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 913185b43ba7df8a52ae186d27b3bd99f8b5909d
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Jul 13 16:47:12 2017 +0000

    Document queue template name override

diff --git a/docs/customizing/templates.pod b/docs/customizing/templates.pod
index 331534c..e35bb5d 100644
--- a/docs/customizing/templates.pod
+++ b/docs/customizing/templates.pod
@@ -170,5 +170,28 @@ HTML" template is the same template formatted in HTML. The 4.2 upgrade provides
 a C<switch-templates-to> script to switch all default templates from plain text
 to HTML or the reverse. See the L<UPGRADING-4.2> notes for details.
 
+=head2 Queue-specific template overrides
+
+Each scrip in RT has a template associated with it. When a scrip goes to send
+email (or use its template for some other purpose), it first tries to load a
+queue-level template with that name. If there is no queue-level template, then
+the scrip will continue by loading the global template with that name.
+
+You can take advantage of this to customize your templates for a specific queue
+by creating a queue-level template with the exact same name as a global
+template. For example, you can make an "Autoreply" template for your Security
+queue which has a completely different message. Other queues will continue to
+use the global "Autoreply" template, but for the Security queue, its special
+"Autoreply" override will be used.
+
+One common pattern is to create a I<blank> template, which the "send email"
+action takes as a hint to avoid sending its email. So by creating a blank queue
+template you can "disable" a specific notification, such as Ticket Taken, for
+an individual queue, while still keeping the scrip globally applied to all
+queues.
+
+You can manage queue-specific templates by visiting
+Admin -> Queues -> Select -> ... -> Templates.
+
 =cut
 

commit b8e3cccc5dfde30af4fc57ca781fa6ce330496c8
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Thu Aug 10 11:09:05 2017 -0400

    Forbid merging non-ticket objects
    
    Each ticket has a type property. Only tickets with the type,
    'ticket', can be merged. For example, 'reminder' tickets
    cannot be merged.
    
    Fixes: I#32700

diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 0f073c3..6b96135 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -1882,6 +1882,11 @@ sub MergeInto {
         return ( 0, $self->loc("Can't merge a ticket into itself") );
     }
 
+    # Only tickets can be merged
+    unless ($MergeInto->Type eq 'ticket' && $self->Type eq 'ticket'){
+        return(0, $self->loc("Only tickets can be merged"));
+    }
+
     # Make sure the current user can modify the new ticket.
     unless ( $MergeInto->CurrentUserHasRight('ModifyTicket') ) {
         return ( 0, $self->loc("Permission Denied") );
diff --git a/t/ticket/merge.t b/t/ticket/merge.t
index 99c723b..cdc107a 100644
--- a/t/ticket/merge.t
+++ b/t/ticket/merge.t
@@ -4,7 +4,7 @@ use warnings;
 
 
 use RT;
-use RT::Test tests => '44';
+use RT::Test tests => undef;
 
 
 # validate that when merging two tickets, the comments from both tickets
@@ -177,3 +177,41 @@ ok $user && $user->id, 'loaded or created user';
         is $from_history, $expected, "history is correct";
     }
 }
+
+# forbid merging tickets into non-ticket types
+{
+
+  # create two tickets
+  my $ticket_1 = RT::Test->create_ticket(
+    Queue => 'General',
+    Subject => 'test ticket 1'
+  );
+  my $ticket_2 = RT::Test->create_ticket(
+    Queue => 'General',
+    Subject => 'test ticket 2'
+  );
+
+  # create a reminder on ticket_1
+  $ticket_1->Reminders->Add(
+    Subject => 'Test Reminder',
+    Owner => 'root',
+  );
+
+  # verify reminder was created
+  my $reminders = $ticket_1->Reminders->Collection;
+  is($reminders->Count, 1, "Reminder successfully added");
+  my $reminder = $reminders->First;
+  is($reminder->Subject, "Test Reminder");
+
+  # verify ticket cannot be merged into non-ticket type
+  my($status, $msg) = $ticket_2->MergeInto($reminder->Id);
+  ok(!$status, 'Only tickets can be merged');
+  like($msg, qr/Only tickets can be merged/);
+
+  # verify non-ticket type cannot merge into a ticket
+  ($status, $msg) = $reminder->MergeInto($ticket_2->Id);
+  ok(!$status, 'Non-ticket types cannot merge into tickets');
+  like($msg, qr/Only tickets can be merged/);
+}
+
+done_testing();

commit fa9291e64823b4a8cd05addd89e4225285853be7
Merge: cfe20af b8e3ccc
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Aug 17 19:53:25 2017 +0000

    Merge branch '4.4/forbid-merging-reminders' into 4.4-trunk


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


More information about the rt-commit mailing list