[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.2-90-g5cfd83a1f

Jim Brandt jbrandt at bestpractical.com
Wed Mar 7 14:38:02 EST 2018


The branch, 4.4-trunk has been updated
       via  5cfd83a1fba949df6f481b54f179fd9532345574 (commit)
       via  20c91bffefac9dcef6b9a3b557b8b0fb7bfbcf77 (commit)
       via  95957255d24100b767e7b2e9d5c78ad4d2ebf2d9 (commit)
       via  157a6359e722aaff1a1d480d92ef6246a01a3482 (commit)
      from  11c61d0c3ba0f192e409529b026e19157dfae6d0 (commit)

Summary of changes:
 docs/query_builder.pod                | 12 ++++++++++++
 share/html/Elements/SelectStatus      |  5 +++++
 share/html/Search/Elements/PickBasics |  2 +-
 t/web/query_builder.t                 | 15 +++++++++++++++
 t/web/query_builder_queue_limits.t    | 14 ++++++++------
 5 files changed, 41 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit 95957255d24100b767e7b2e9d5c78ad4d2ebf2d9
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Wed Jan 10 15:54:13 2018 -0500

    Update query builder tests for active and inactive statuses
    
    Query builder tests were added and existing ones were updated to
    verify when searching for tickets with an active or inactive
    status, the correct query is generated.

diff --git a/t/web/query_builder.t b/t/web/query_builder.t
index dbe909939..917cc3806 100644
--- a/t/web/query_builder.t
+++ b/t/web/query_builder.t
@@ -3,7 +3,7 @@ use warnings;
 use HTTP::Request::Common;
 use HTTP::Cookies;
 use LWP;
-use RT::Test tests => 70;
+use RT::Test tests => undef;
 
 my $cookie_jar = HTTP::Cookies->new;
 my ($baseurl, $agent) = RT::Test->started_ok;
@@ -324,3 +324,20 @@ diag "make sure skipped order by field doesn't break search";
         url_regex => qr{/Ticket/Display\.html},
     ), "link to the ticket" );
 }
+
+diag "make sure active and inactive statuses generate the correct query";
+{
+    $agent->get_ok( $url . '/Search/Build.html?NewQuery=1' );
+    ok( $agent->form_name( 'BuildQuery' ), "found the form" );
+    $agent->field( ValueOfStatus => 'active' );
+    $agent->click( 'AddClause' );
+    is getQueryFromForm( $agent ), "Status = '__Active__'", "active status generated the correct query";
+
+    $agent->get_ok( $url . '/Search/Build.html?NewQuery=1' );
+    ok( $agent->form_name( 'BuildQuery' ), "found the form" );
+    $agent->field( ValueOfStatus => 'inactive' );
+    $agent->click( 'AddClause' );
+    is getQueryFromForm( $agent ), "Status = '__Inactive__'", "inactive status generated the correct query";
+}
+
+done_testing;
diff --git a/t/web/query_builder_queue_limits.t b/t/web/query_builder_queue_limits.t
index c1f0a72e3..256092f4c 100644
--- a/t/web/query_builder_queue_limits.t
+++ b/t/web/query_builder_queue_limits.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 34;
+use RT::Test tests => undef;
 
 my $lifecycles = RT->Config->Get('Lifecycles');
 $lifecycles->{foo} = {
@@ -78,7 +78,7 @@ ok( !$form->find_input("ValueOfCF.{foo_cf}"), 'no foo_cf by default' );
 my $status_input = $form->find_input('ValueOfStatus');
 my @statuses     = sort $status_input->possible_values;
 is_deeply(
-    \@statuses, [ '', qw/initial new open open rejected resolved resolved stalled/], 'found all statuses'
+    \@statuses, [ '', qw/__Active__ __Inactive__ initial new open open rejected resolved resolved stalled/], 'found all statuses'
 ) or diag "Statuses are: ", explain \@statuses;
 
 my $owner_input = $form->find_input('ValueOfActor');
@@ -101,7 +101,7 @@ $status_input = $form->find_input('ValueOfStatus');
 @statuses     = sort $status_input->possible_values;
 is_deeply(
     \@statuses,
-    [ '', qw/initial open resolved/ ],
+    [ '', qw/__Active__ __Inactive__ initial open resolved/ ],
     'found statuses from foo only'
 );
 
@@ -126,7 +126,7 @@ $status_input = $form->find_input('ValueOfStatus');
 @statuses     = sort $status_input->possible_values;
 is_deeply(
     \@statuses,
-    [ '', qw/initial new open open rejected resolved resolved stalled/ ],
+    [ '', qw/__Active__ __Inactive__ initial new open open rejected resolved resolved stalled/ ],
     'found all statuses again'
 ) or diag "Statuses are: ", explain \@statuses;
 $owner_input = $form->find_input('ValueOfActor');
@@ -150,7 +150,7 @@ ok( !$form->find_input("ValueOfCF.{general_cf}"), 'no general_cf' );
 $status_input = $form->find_input('ValueOfStatus');
 @statuses     = sort $status_input->possible_values;
 is_deeply(
-    \@statuses, [ '', qw/initial new open open rejected resolved resolved stalled/],
+    \@statuses, [ '', qw/__Active__ __Inactive__ initial new open open rejected resolved resolved stalled/],
     'found all statuses'
 ) or diag "Statuses are: ", explain \@statuses;
 $owner_input = $form->find_input('ValueOfActor');
@@ -173,7 +173,7 @@ $status_input = $form->find_input('ValueOfStatus');
 @statuses     = sort $status_input->possible_values;
 is_deeply(
     \@statuses,
-    [ '', qw/initial new open open rejected resolved resolved stalled/ ],
+    [ '', qw/__Active__ __Inactive__ initial new open open rejected resolved resolved stalled/ ],
     'found all statuses'
 ) or diag "Statuses are: ", explain \@statuses;
 $owner_input = $form->find_input('ValueOfActor');
@@ -181,3 +181,5 @@ $owner_input = $form->find_input('ValueOfActor');
 is_deeply(
     \@owners, [ '', qw/Nobody root user_a user_b/], 'found all users'
 );
+
+done_testing;

commit 20c91bffefac9dcef6b9a3b557b8b0fb7bfbcf77
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Thu Jan 11 13:19:36 2018 -0500

    Update query builder docs to include active/inactive status

diff --git a/docs/query_builder.pod b/docs/query_builder.pod
index c84b40e60..da08d93be 100644
--- a/docs/query_builder.pod
+++ b/docs/query_builder.pod
@@ -27,6 +27,18 @@ src="images/search-criteria.png">
 
 =for :man [Search Criteria F<docs/images/search-criteria.png>]
 
+RT also has two meta-statuses, 'active' and 'inactive'. By selecting either of
+these from the status dropdown of the query builder, you will no longer need
+to explicitly list all of the active or inactive statuses or manually enter
+the queries: "Status = '__Active__'" or "Status = '__Inactive__'".
+
+The sets of active and inactive statuses for a queue are defined by the
+associated lifecycle. Active tickets are those listed for the 'active' and
+'initial' configurations. Inactive tickets are those defined as 'inactive'.
+For the default RT lifecycle, for example, the active statuses are new, open,
+and stalled, and the inactive statuses are resolved, rejected and deleted. See
+F<docs/customizing/lifecycles.pod> for more information.
+
 Now that I've selected some criteria, I can click either Add These Terms or
 Add These Terms and Search. I'll click the former:
 

commit 5cfd83a1fba949df6f481b54f179fd9532345574
Merge: 11c61d0c3 20c91bffe
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Mar 7 14:27:26 2018 -0500

    Merge branch '4.4/querybuilder-active-and-inactive-status' into 4.4-trunk

diff --cc t/web/query_builder.t
index 2c11801a0,917cc3806..c00345ade
--- a/t/web/query_builder.t
+++ b/t/web/query_builder.t
@@@ -326,74 -325,19 +326,89 @@@ diag "make sure skipped order by field 
      ), "link to the ticket" );
  }
  
 +diag "make sure the list of columns available in the 'Order by' dropdowns are complete";
 +{
 +    $agent->get_ok($url . 'Search/Build.html');
 +
 +    my @orderby = qw(
 +        AdminCc.EmailAddress
 +        Cc.EmailAddress
 +        Created
 +        Creator
 +        Custom.Ownership
 +        Due
 +        FinalPriority
 +        InitialPriority
 +        LastUpdated
 +        LastUpdatedBy
 +        Owner
 +        Priority
 +        Queue
 +        Requestor.EmailAddress
 +        Resolved
 +        SLA
 +        Started
 +        Starts
 +        Status
 +        Subject
 +        TimeEstimated
 +        TimeLeft
 +        TimeWorked
 +        Told
 +        Type
 +        id
 +    );
 +
 +    my $orderby = join(' ', sort @orderby);
 +
 +    my @scraped_orderbys = $agent->scrape_text_by_attr('name', 'OrderBy');
 +
 +    my $first_orderby = shift @scraped_orderbys;
 +    is ($first_orderby, $orderby);
 +
 +    foreach my $scraped_orderby ( @scraped_orderbys ) {
 +            is ($scraped_orderby, '[none] '.$orderby);
 +    }
 +
 +    my $cf = RT::Test->load_or_create_custom_field(
 +        Name  => 'Location',
 +        Queue => 'General',
 +        Type  => 'FreeformSingle', );
 +    isa_ok( $cf, 'RT::CustomField' );
 +
 +    ok($agent->form_name('BuildQuery'), "found the form");
 +    $agent->field("ValueOfQueue", "General");
 +    $agent->submit;
 +
 +    push @orderby, 'CustomField.{Location}';
 +
 +    $orderby = join(' ', sort @orderby);
 +
 +    @scraped_orderbys = $agent->scrape_text_by_attr('name', 'OrderBy');
 +
 +    $first_orderby = shift @scraped_orderbys;
 +    is ($first_orderby, $orderby);
 +
 +    foreach my $scraped_orderby ( @scraped_orderbys ) {
 +        is ($scraped_orderby, '[none] '.$orderby);
 +    }
 +
 +    $cf->SetDisabled(1);
 +}
 +
+ diag "make sure active and inactive statuses generate the correct query";
+ {
+     $agent->get_ok( $url . '/Search/Build.html?NewQuery=1' );
+     ok( $agent->form_name( 'BuildQuery' ), "found the form" );
+     $agent->field( ValueOfStatus => 'active' );
+     $agent->click( 'AddClause' );
+     is getQueryFromForm( $agent ), "Status = '__Active__'", "active status generated the correct query";
+ 
+     $agent->get_ok( $url . '/Search/Build.html?NewQuery=1' );
+     ok( $agent->form_name( 'BuildQuery' ), "found the form" );
+     $agent->field( ValueOfStatus => 'inactive' );
+     $agent->click( 'AddClause' );
+     is getQueryFromForm( $agent ), "Status = '__Inactive__'", "inactive status generated the correct query";
+ }
+ 
  done_testing;

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


More information about the rt-commit mailing list