[Rt-commit] rt branch 5.0/exclude-owner-from-one-time-inputs created. rt-5.0.3-410-g259f7a5d2f

BPS Git Server git at git.bestpractical.com
Tue Apr 4 21:42:04 UTC 2023


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".

The branch, 5.0/exclude-owner-from-one-time-inputs has been created
        at  259f7a5d2f007da8582345e1257771c91add951f (commit)

- Log -----------------------------------------------------------------
commit 259f7a5d2f007da8582345e1257771c91add951f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Apr 5 03:08:59 2023 +0800

    Exclude owner email address from one time Cc/Bcc inputs
    
    One-time inputs are for users mentioned in the ticket but not watchers.
    Owner is a ticket watcher and is not supposed to be listed there.

diff --git a/share/html/Ticket/Elements/UpdateCc b/share/html/Ticket/Elements/UpdateCc
index 83a73272a8..bbbf4f419e 100644
--- a/share/html/Ticket/Elements/UpdateCc
+++ b/share/html/Ticket/Elements/UpdateCc
@@ -176,6 +176,9 @@ my %txn_addresses = %{$TicketObj->TransactionAddresses};
 my @people_addresses = Email::Address->parse( $TicketObj->RequestorAddresses );
 push @people_addresses, Email::Address->parse( $TicketObj->CcAddresses );
 push @people_addresses, Email::Address->parse( $TicketObj->AdminCcAddresses );
+if ( my $owner_email = $TicketObj->OwnerObj->EmailAddress ) {
+    push @people_addresses, Email::Address->parse( $owner_email );
+}
 
 my @one_time_Ccs;
 

commit 96df4632157ab76a2a05789cdc16db074eaddef9
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Apr 5 05:26:46 2023 +0800

    Test checkboxes for one-time Cc/Bcc on ticket update page

diff --git a/t/web/ticket_role_input.t b/t/web/ticket_role_input.t
index e6ebc2af39..24415caca1 100644
--- a/t/web/ticket_role_input.t
+++ b/t/web/ticket_role_input.t
@@ -18,6 +18,7 @@ ok( $root->Load( 'root' ), 'load root user' );
 
 my $alice = RT::Test->load_or_create_user( Name => 'alice', EmailAddress => 'alice at example.com' );
 ok( $alice->id, 'created user alice' );
+ok( $alice->PrincipalObj->GrantRight( Object => RT->System, Right => 'OwnTicket' ) );
 
 my $bob = RT::Test->load_or_create_user( Name => 'bob', EmailAddress => 'bob at example.com' );
 ok( $bob->id, 'created user bob' );
@@ -129,6 +130,47 @@ diag "Test ticket update page";
     $m->content_contains( 'BCC: richard at example.com' );
 }
 
+diag "Test checkboxes for One-time Cc/Bcc on ticket update page";
+{
+
+    my $ticket = RT::Test->create_ticket(
+        Queue      => $queue,
+        Subject    => 'test inputs on update',
+        Content    => 'test content',
+        Requestor  => 'foo at example.com',
+        Cc         => 'richard at example.com',
+        AdminCc    => 'bob',
+    );
+    $m->goto_ticket( $ticket->id, 'Update' );
+    is( $m->dom->find('.ticket-update-suggested-cc input')->size, 0, 'No one-time checkboxes' );
+
+    $m->submit_form_ok(
+        {
+            form_name => 'TicketUpdate',
+            fields    => {
+                UpdateContent => 'test content',
+                UpdateCc      => 'alice at example.com, foo at example.com',
+                UpdateBcc      => 'richard at example.com, bob at example.com',
+            },
+            button => 'SubmitTicket',
+        },
+        'submit form TicketUpdate'
+    );
+    $m->content_contains('Comments added');
+
+    $m->goto_ticket( $ticket->id, 'Update' );
+
+    is( $m->dom->find('.ticket-update-suggested-cc input')->size, 2, 'Two one-time checkboxes' );
+    ok( $m->dom->at('.ticket-update-suggested-cc input[name="UpdateCc-alice at example.com"]'),
+        'One-time Cc checkbox for alice at example.com' );
+    ok( $m->dom->at('.ticket-update-suggested-cc input[name="UpdateBcc-alice at example.com"]'),
+        'One-time Bcc checkbox for alice at example.com' );
+
+    ok( $ticket->SetOwner( $alice->Id ) );
+    $m->goto_ticket( $ticket->id, 'Update' );
+    is( $m->dom->find('.ticket-update-suggested-cc input')->size, 0, 'No one-time checkboxes' );
+}
+
 diag "Test ticket bulk update page";
 {
 

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list