[Rt-commit] rt branch, 4.4/improve-create-custom-field-message, created. rt-4.4.2rc1-42-g6029bea

Maureen Mirville maureen at bestpractical.com
Fri Sep 29 12:02:46 EDT 2017


The branch, 4.4/improve-create-custom-field-message has been created
        at  6029bead35d07483635be69cd857ec05029ecdbe (commit)

- Log -----------------------------------------------------------------
commit 9b70dd3577c74493eb9ae53857324ebf192ca127
Merge: ff7a847 c4b0d35
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Jun 1 15:39:27 2017 +0000

    Merge branch 'security/4.4/password-timing-attack' into security/4.4.2-releng


commit 7b731bfce3dd5662af7a29e2bb18ff1f6694bb3a
Merge: d487efa 9b70dd3
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Jun 15 13:48:24 2017 -0400

    Merge branch 'security/4.4.2-releng' into 4.4.2-releng


commit a8840bb66c22b5a3b4ac50112cbe3cd7070ff0b7
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Tue Jun 27 08:46:48 2017 -0400

    Apply unset-field when cfs do not have a count
    
    In converting a ternary evaluation of $count to an if,
    523fabb1 missed a 'not' to correctly add unset-field to
    cfs with no values, flipping the set/unset visibility logic.

diff --git a/share/html/Elements/ShowCustomFields b/share/html/Elements/ShowCustomFields
index c6df0d3..2f7d2ae 100644
--- a/share/html/Elements/ShowCustomFields
+++ b/share/html/Elements/ShowCustomFields
@@ -58,7 +58,7 @@
 %   'custom-field',
 %   'custom-field-'.$CustomField->id,
 % );
-% push @classes, 'unset-field' if $count;
+% push @classes, 'unset-field' if not $count;
 % $m->callback( CallbackName => 'ModifyFieldClasses', CustomField => $CustomField,
 %               Object => $Object, Classes => \@classes, Grouping => $Grouping );
   <tr class="<% join(' ', @classes) %>" id="CF-<%$CustomField->id%>-ShowRow">

commit 1029d0622e14e15d485c9946d8c91637d9890135
Merge: 2c91d22 710345c
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri Aug 4 17:08:19 2017 +0000

    Merge branch '4.4/passwd-script' into 4.4-trunk


commit 2c91d2268ecc4d447277f2133990ba259469d112
Merge: 1bf00eb a8840bb
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Jul 26 20:35:38 2017 +0000

    Merge branch '4.4.2-releng' into 4.4-trunk


commit 51ebb5fbfcd8612e4c950b792301ec70986b0ce9
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Jul 28 13:39:21 2017 -0400

    Add an option to treat attached email messages as normal file attachments
    
    Fixes: I#32833

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 0899c7e..48fd0fe 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -503,6 +503,23 @@ clean up intentional double newlines as well.
 
 Set( $CheckMoreMSMailHeaders, 0);
 
+=item C<$TreatAttachedEmailAsFiles>
+
+Email coming into RT can sometimes have another email attached, when
+an email is forwarded as an attachment, for example. By default, RT recognizes
+that the attached content is an email and does some processing, including
+some parsing the headers of the attached email. You can see this in suggested
+email addresses on the People page and One-time Cc on reply.
+
+If you want RT to treat attached email files as regular file attachments,
+set this option to true (1). With this option enabled, attached email will
+show up in the "Attachments" section like other types of file attachments
+and content like headers will not be processed.
+
+=cut
+
+Set( $TreatAttachedEmailAsFiles, 0);
+
 =back
 
 
diff --git a/lib/RT/EmailParser.pm b/lib/RT/EmailParser.pm
index 61fcd13..26da75e 100644
--- a/lib/RT/EmailParser.pm
+++ b/lib/RT/EmailParser.pm
@@ -60,6 +60,7 @@ use MIME::Entity;
 use MIME::Head;
 use MIME::Parser;
 use File::Temp qw/tempdir/;
+use RT::Util qw(mime_recommended_filename EntityLooksLikeEmailMessage);
 
 =head1 NAME
 
@@ -270,6 +271,8 @@ sub _PostProcessNewEntity {
 
     #Now we've got a parsed mime object. 
 
+    _DetectAttachedEmailFiles($self->{'entity'});
+
     # Unfold headers that are have embedded newlines
     #  Better do this before conversion or it will break
     #  with multiline encoded Subject (RFC2047) (fsck.com #5594)
@@ -279,6 +282,70 @@ sub _PostProcessNewEntity {
     RT::I18N::SetMIMEEntityToEncoding($self->{'entity'}, 'utf-8');
 }
 
+=head2 _DetectAttachedEmailFiles
+
+Email messages submitted as attachments will be processed as a nested email
+rather than an attached file. Users may prefer to treat attached emails
+as normal file attachments and not have them processed.
+
+If TreatAttachedEmailAsFiles is selected, treat attached email files
+as regular file attachments. We do this by checking MIME entities that
+have email (message/) content types and also have a defined filename,
+indicating they are attachments.
+
+See the extract_nested_messages documentation in in the L<MIME::Parser>
+module for details on how it deals with nested email messages.
+
+=cut
+
+sub _DetectAttachedEmailFiles {
+    my $entity = shift;
+
+    return unless RT->Config->Get('TreatAttachedEmailAsFiles');
+
+    my $filename = mime_recommended_filename($entity);
+
+    # This detection is based on the way MIME::Parser handles email with
+    # extract_nested_messages enabled.
+
+    if ( EntityLooksLikeEmailMessage($entity)
+         && not defined $entity->bodyhandle
+         && $filename ) {
+
+        # Fixup message
+        # TODO: Investigate proposing an option upstream in MIME::Parser to avoid the initial parse
+        if ( $entity->parts(0) ){
+            my $bodyhandle = $entity->parts(0)->bodyhandle;
+
+            # Get the headers from the part and write them back to the body.
+            # This will create a file attachment that looks like the file you get if
+            # you "Save As" and email message in your email client.
+            # If we don't save them here, the headers from the attached email will be lost.
+
+            my $headers = $entity->parts(0)->head->as_string;
+            my $body = $bodyhandle->as_string;
+
+            my $IO = $bodyhandle->open("w")
+                || RT::Logger->error("Unable to open email body: $!");
+            $IO->print($headers . "\n");
+            $IO->print($body);
+            $IO->close
+                || RT::Logger->error("Unable to close email body: $!");
+
+            $entity->parts([]);
+            $entity->bodyhandle($bodyhandle);
+            RT::Logger->debug("Manually setting bodyhandle for attached email file");
+        }
+    }
+    elsif ( $entity->parts ) {
+        foreach my $part ( $entity->parts ){
+            _DetectAttachedEmailFiles( $part );
+        }
+    }
+
+    return;
+}
+
 =head2 IsRTaddress ADDRESS
 
 Takes a single parameter, an email address. 
@@ -333,9 +400,6 @@ sub CullRTAddresses {
 }
 
 
-
-
-
 # LookupExternalUserInfo is a site-definable method for synchronizing
 # incoming users with an external data source. 
 #
diff --git a/lib/RT/Util.pm b/lib/RT/Util.pm
index 317a208..2be9afd 100644
--- a/lib/RT/Util.pm
+++ b/lib/RT/Util.pm
@@ -52,7 +52,7 @@ use warnings;
 
 
 use base 'Exporter';
-our @EXPORT = qw/safe_run_child mime_recommended_filename/;
+our @EXPORT = qw/safe_run_child mime_recommended_filename EntityLooksLikeEmailMessage/;
 
 use Encode qw/encode/;
 
@@ -203,6 +203,30 @@ sub constant_time_eq {
     return 0 + not $result;
 }
 
+=head2 EntityLooksLikeEmailMessage( MIME::Entity )
+
+Check MIME type headers for entities that look like email.
+
+=cut
+
+sub EntityLooksLikeEmailMessage {
+    my $entity = shift;
+
+    return unless $entity;
+
+    # Use mime_type instead of effective_type to get the same headers
+    # MIME::Parser used.
+    my $mime_type = $entity->mime_type();
+
+    # This is the same list of MIME types MIME::Parser uses. The partial and
+    # external-body types are unlikely to produce usable attachments, but they
+    # are still recognized as email for the purposes of this function.
+
+    my @email_types = ('message/rfc822', 'message/partial', 'message/external-body');
+
+    return 1 if grep { $mime_type eq $_ } @email_types;
+    return 0;
+}
 
 RT::Base->_ImportOverlays();
 

commit cb464b4e6b22f17a2735f437323bda11c2a43872
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Jul 28 15:38:44 2017 -0400

    Restore attached email parsing when $TreatAttachedEmailAsFiles is not set
    
    For cases where RT parses emails that come in as attachments to
    other email, restore the previous parsing of additional headers.
    This will show email addresses from attached email as suggestions on
    the People page and on reply. This is useful to more easily set up
    roles on a ticket in cases where someone forwards email into RT
    that was intended for another person or queue.
    
    The $TreatAttachedEmailAsFiles option now provides an alternate
    behavior for email attachments that doesn't try to parse attached
    email. When this is set, get email addresses only from the parent
    attachment.

diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 3a24100..0f073c3 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -1052,10 +1052,14 @@ sub TransactionAddresses {
     $attachments->LimitByTicket( $self->id );
     $attachments->Columns( qw( id Headers TransactionId));
 
-    $attachments->Limit(
-        FIELD => 'Parent',
-        VALUE => 0,
-    );
+    # If $TreatAttachedEmailAsFiles is set, don't parse child attachments
+    # for email addresses.
+    if ( RT->Config->Get('TreatAttachedEmailAsFiles') ){
+        $attachments->Limit(
+            FIELD => 'Parent',
+            VALUE => 0,
+        );
+    }
 
     $attachments->Limit(
         ALIAS         => $attachments->TransactionAlias,

commit 5e5aa504887de2ecbc96012ec78ec133c555d731
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Jul 28 13:46:46 2017 -0400

    Tests for email file attachments

diff --git a/t/data/emails/email-file-attachment.eml b/t/data/emails/email-file-attachment.eml
new file mode 100644
index 0000000..129bd9f
--- /dev/null
+++ b/t/data/emails/email-file-attachment.eml
@@ -0,0 +1,67 @@
+Return-Path: <user1 at example.com>
+X-Spam-Flag: NO
+X-Spam-Score: -2.449
+X-Spam-Level: 
+X-Spam-Status: No, score=-2.449 tagged_above=-99.9 required=10
+	tests=[AWL=0.250, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
+	DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, KHOP_DYNAMIC=0.001,
+	RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham
+X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,,
+ definitions=2017-07-28_05:,, signatures=0
+X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0
+ clxscore=1034 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0
+ bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1
+ engine=8.0.1-1701120000 definitions=main-1707280209
+From: Jim Brandt <user1 at example.com>
+Content-type: multipart/mixed;
+ boundary="Apple-Mail=_E5E623A8-7064-4736-9F2E-2A0F35E3635B"
+Subject: This is a test
+Message-id: <A23A3AC0-D9E3-4965-83DF-F29217AF28F6 at mac.com>
+Date: Fri, 28 Jul 2017 09:21:48 -0400
+To: rt at example.com
+MIME-version: 1.0 (Mac OS X Mail 9.3 \(3124\))
+X-Mailer: Apple Mail (2.3124)
+
+
+--Apple-Mail=_E5E623A8-7064-4736-9F2E-2A0F35E3635B
+Content-Transfer-Encoding: 7bit
+Content-Type: text/plain;
+	charset=us-ascii
+
+This is a test with an email file attachment.
+
+
+--Apple-Mail=_E5E623A8-7064-4736-9F2E-2A0F35E3635B
+Content-Disposition: attachment;
+	filename=test-email.eml
+Content-Type: message/rfc822;
+	name="test-email.eml"
+Content-Transfer-Encoding: binary
+
+Return-Path: <user1 at example.com>
+X-Spam-Flag: NO
+X-Spam-Score: -2.199
+X-Spam-Level: 
+X-Spam-Status: No, score=-2.199 tagged_above=-99.9 required=10
+	tests=[AWL=0.500, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
+	DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, KHOP_DYNAMIC=0.001,
+	RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham
+X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,,
+ definitions=2017-07-28_05:,, signatures=0
+X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0
+ clxscore=1034 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0
+ bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1
+ engine=8.0.1-1701120000 definitions=main-1707280209
+From: Jim Brandt <user1 at example.com>
+Content-type: text/plain; charset=us-ascii
+Content-transfer-encoding: 7bit
+Subject: This is a test
+Message-id: <8DB138B7-D410-4640-81B0-7A3363EB0180 at mac.com>
+Date: Fri, 28 Jul 2017 09:19:28 -0400
+To: rt at example.com
+MIME-version: 1.0 (Mac OS X Mail 9.3 \(3124\))
+X-Mailer: Apple Mail (2.3124)
+
+This is a test.
+
+--Apple-Mail=_E5E623A8-7064-4736-9F2E-2A0F35E3635B--
diff --git a/t/mail/email-file-attachments.t b/t/mail/email-file-attachments.t
new file mode 100644
index 0000000..265424e
--- /dev/null
+++ b/t/mail/email-file-attachments.t
@@ -0,0 +1,58 @@
+use strict;
+use warnings;
+
+use RT::Test tests => undef,
+    config => 'Set( $TreatAttachedEmailAsFiles, 1);'
+;
+
+use File::Spec ();
+use Email::Abstract;
+
+# We're not testing acls here.
+my $everyone = RT::Group->new(RT->SystemUser);
+$everyone->LoadSystemInternalGroup('Everyone');
+$everyone->PrincipalObj->GrantRight( Right =>'SuperUser' );
+
+# some utils
+sub first_txn    { return $_[0]->Transactions->First }
+sub count_attachs { return first_txn($_[0])->Attachments->Count }
+
+sub mail_in_ticket {
+    my ($filename) = @_;
+    my $path = RT::Test::get_relocatable_file($filename,
+        (File::Spec->updir(), 'data', 'emails'));
+    my $content = RT::Test->file_content($path);
+
+    RT::Test->clean_caught_mails;
+    my ($status, $id) = RT::Test->send_via_mailgate( $content );
+    ok( !$status, "Fed $filename into mailgate");
+
+    my $ticket = RT::Ticket->new(RT->SystemUser);
+    $ticket->Load($id);
+    ok( $ticket->Id, "Successfully created ticket ".$ticket->Id);
+
+    my @mail = map {Email::Abstract->new($_)->cast('MIME::Entity')}
+        RT::Test->fetch_caught_mails;
+    return ($ticket, @mail);
+}
+
+diag "Process email with an email file attached";
+{
+    my ($ticket) = mail_in_ticket('email-file-attachment.eml');
+    like( first_txn($ticket)->Content , qr/This is a test with an email file attachment/, "Parsed the email body");
+    is( count_attachs($ticket), 3,
+        "Has three attachments, presumably multipart/mixed, text-plain, message");
+
+    my $attachments = $ticket->Transactions->First->Attachments;
+
+    my $attachment = $attachments->Next;
+    is( $attachment->Subject, 'This is a test', 'Subject is correct' );
+
+    $attachment = $attachments->Next;
+    is( $attachment->ContentType, 'text/plain', 'Got the first part of the main email' );
+
+    $attachment = $attachments->Next;
+    is( $attachment->Filename, 'test-email.eml', 'Got a filename for the attached email file' );
+}
+
+done_testing();

commit 4693c5e4d9e97fbf83b50fbb68408b92a7a22cb1
Merge: 1029d06 5e5aa50
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri Aug 4 17:41:06 2017 +0000

    Merge branch '4.4/email-file-attachments' into 4.4-trunk


commit 733c523f245a7dd593a6cb1a6ff3a6e104a00cb9
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Fri Jul 21 16:53:55 2017 -0400

    Initial test warning string updates

diff --git a/t/web/gnupg-select-keys-on-update.t b/t/web/gnupg-select-keys-on-update.t
index 24d22e7..d7a315f 100644
--- a/t/web/gnupg-select-keys-on-update.t
+++ b/t/web/gnupg-select-keys-on-update.t
@@ -45,7 +45,7 @@ diag "check that signing doesn't work if there is no key";
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
 
-    $m->next_warning_like(qr/secret key not available/);
+    $m->next_warning_like(qr/(secret key not available|No secret key)/);
     $m->no_leftover_warnings_ok;
 }
 
@@ -82,7 +82,7 @@ diag "check that things don't work if there is no key";
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
 
-    $m->next_warning_like(qr/public key not found/) for 1 .. 2;
+    $m->next_warning_like(qr/(public key not found|No public key)/) for 1 .. 2;
     $m->no_leftover_warnings_ok;
 }
 

commit c6f5f21c9e58405a35f8ac5c36afe8dc353042ee
Merge: 733c523 619cfa6
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Mon Aug 7 12:50:59 2017 -0400

    Merge branch '4.4/queue-template-doc' into 4.4-trunk


commit 6ba420c1f656da1b6d44495a3f93e536a82e6377
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 12a6d5dbd14d95228e66dd000de0c6c6565c0b69
Merge: c6f5f21 4ce55ae
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Aug 16 16:16:22 2017 -0400

    Merge branch '4.4/default-queue-linkedticket' into 4.4-trunk


commit ac62f5d4822b02d00f7466124c3814228a37de28
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 09806ea5d4cf57fa795b46d86d2a98dece42e912
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Mon Aug 7 11:52:25 2017 -0400

    Verify default queue
    
    Tests added to verify default queue displayed on ticket page under
    "Create [link relationship] Ticket in [queue]" is correct.

diff --git a/t/web/ticket_links.t b/t/web/ticket_links.t
index 994630e..3f7f384 100644
--- a/t/web/ticket_links.t
+++ b/t/web/ticket_links.t
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use RT::Test tests => 146;
+use RT::Test tests => 152;
 
 my ( $baseurl, $m ) = RT::Test->started_ok;
 ok( $m->login, "Logged in" );
@@ -8,6 +8,36 @@ ok( $m->login, "Logged in" );
 my $queue = RT::Test->load_or_create_queue( Name => 'General' );
 ok( $queue->id, "loaded the General queue" );
 
+# Create a new queue
+my $queue_2 = RT::Test->load_or_create_queue( Name => 'NewQueue');
+ok( $queue_2->id, "New queue created, 'NewQueue'");
+
+# Create a new ticket
+$m->get_ok($baseurl . '/Ticket/Create.html?Queue=1');
+$m->form_name('TicketCreate');
+$m->field(Subject => 'testing new ticket');
+$m->click_button(value => 'Create');
+
+# Set NewQueue as default queue
+$m->get_ok($baseurl . '/Prefs/Other.html');
+$m->submit_form_ok({
+  form_name => 'ModifyPreferences',
+  fields => {
+    DefaultQueue => 'NewQueue',
+  },
+  button => 'Update'
+}, 'NewQueue set as default queue');
+
+# Verify NewQueue is the default queue on ticket page
+$m->get_ok($baseurl . '/Ticket/Display.html?id=1');
+my $selected_queue_node = $m->dom->at('select[name=CloneQueue] option:checked');
+if ($selected_queue_node) {
+    is($selected_queue_node->all_text, 'NewQueue');
+}
+else {
+    fail("no selected queue for clone queue");
+}
+
 my ( $deleted, $active, $inactive ) = RT::Test->create_tickets(
     { Queue   => 'General' },
     { Subject => 'deleted ticket', },

commit b8f074f99f03dffda501ad1b40f214b86f01ac22
Merge: 12a6d5d ac62f5d
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


commit 80a043646bb57c32f988bcd1c9a763b87fbfa5e4
Merge: b8f074f 09806ea
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Aug 17 20:13:40 2017 +0000

    Merge branch '4.4/testing-default-queue-linkedticket' into 4.4-trunk


commit b9ea27175f19abeb7cfd4729b354ee8fde9c2cc7
Merge: 80a0436 c72888b
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri Aug 25 17:31:43 2017 -0400

    Merge branch '4.4/utf8-internal-encoding-issue' into 4.4-trunk


commit 6029bead35d07483635be69cd857ec05029ecdbe
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Wed Aug 30 10:09:27 2017 -0400

    Improve message for adding/deleting a new custom field value
    
    When user is creating a custom field and adding values as options,
    or deleting existing values, previous message after adding a value,
    "Object created", and after deleting a value, "Object deleted", was
    unclear. Message updated to make it clear user added or deleted a
    specific custom field value.
    
    Fixes: I#32695

diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index 80cb05d..2b9a28c 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -341,6 +341,8 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
     foreach my $key ( keys %ARGS ) {
         next unless $key =~ /^Delete-$paramtag-(\d+)$/;
         my ($val, $msg) = $CustomFieldObj->DeleteValue( $1 );
+        my $cf_delete = $ARGS{ $paramtag . "-$1-Name" };
+        $msg = loc("Custom field value [_1] deleted", $cf_delete) if $val;
         push (@results, $msg);
     }
 
@@ -369,6 +371,8 @@ if ( $ARGS{'Update'} && $id ne 'new' ) {
                 $ARGS{$paramtag."-new-$_"} =~ s/\s+$//;
                 $_ => $ARGS{ $paramtag ."-new-$_" } } grep { defined $ARGS{ $paramtag ."-new-$_" } } qw/ Name Description SortOrder Category/
         );
+        my $cf_add = $ARGS{ $paramtag.'-new-Name' };
+        $msg = loc("Custom field value [_1] added", $cf_add) if $id;
         push (@results, $msg);
         $added_cfv = 1 if $id;
 
diff --git a/t/web/cf_select_one.t b/t/web/cf_select_one.t
index ce11833..a8b93d5 100644
--- a/t/web/cf_select_one.t
+++ b/t/web/cf_select_one.t
@@ -36,7 +36,7 @@ diag "add 'qwe', 'ASD', '0' and ' foo ' as values to the CF";
             },
             button => 'Update',
         );
-        $m->content_contains('Object created', 'added a value to the CF' ); # or diag $m->content;
+        $m->content_contains('custom field value added', 'added a value to the CF' ); # or diag $m->content;
         my $v = $value;
         $v =~ s/^\s+$//;
         $v =~ s/\s+$//;

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


More information about the rt-commit mailing list