[Rt-commit] rt branch, 4.4/queue-in-orderby, created. rt-4.4.2-58-gc6a7c6ed8

Brian Duggan brian at bestpractical.com
Mon Feb 5 16:18:41 EST 2018


The branch, 4.4/queue-in-orderby has been created
        at  c6a7c6ed8309648e98f231655c942d836113d912 (commit)

- Log -----------------------------------------------------------------
commit c050e5bcac2ac07ef29794429b59121fcf7a7936
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Tue Dec 12 11:50:37 2017 -0500

    Add test for 'Order by' dropdown content
    
    Test the presence of both core and custom field sortable ticket values
    in the 'Order by' dropdown in search builder.

diff --git a/t/web/query_builder.t b/t/web/query_builder.t
index dbe909939..2c11801a0 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;
@@ -219,6 +219,7 @@ diag "click advanced, enter 'C1 OR ( C2 AND C3 )', apply, aggregators should sta
         "no changes, no duplicate condition with badly encoded text"
     );
 
+   $cf->SetDisabled(1);
 }
 
 diag "input a condition, select (several conditions), click delete";
@@ -324,3 +325,75 @@ diag "make sure skipped order by field doesn't break search";
         url_regex => qr{/Ticket/Display\.html},
     ), "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);
+}
+
+done_testing;

commit c6a7c6ed8309648e98f231655c942d836113d912
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Tue Dec 12 09:50:31 2017 -0500

    Re-add Queue to 'Order by' dropdown in Search Builder
    
    Commit 8d0e8cf80f added support for searching by LIKE and NOT LIKE on
    queue. /Search/Elements/EditSort filters ticket fields by whether they
    have an ENUM key, among others. This change removed the ENUM key from
    the value for Queue in %FIELD_METADATA in /lib/RT/Tickets.pm. As a
    side effect, EditSort filtered Queue out of the fields to display in
    'Order by' dropdown in the Search Builder.
    
    This change adds the 'QUEUE' key, which Queue has in Tickets.pm, to
    the list of keys EditSort selects from ticket fields. This makes Queue
    available in the 'Order by' dropdown again.

diff --git a/share/html/Search/Elements/EditSort b/share/html/Search/Elements/EditSort
index 4853e17f2..8b6467145 100644
--- a/share/html/Search/Elements/EditSort
+++ b/share/html/Search/Elements/EditSort
@@ -104,7 +104,7 @@ my %fields;
 
 for my $field (keys %FieldDescriptions) {
     next if $field eq 'EffectiveId';
-    next unless $FieldDescriptions{$field}->[0] =~ /^(?:ENUM|INT|DATE|STRING|ID)$/;
+    next unless $FieldDescriptions{$field}->[0] =~ /^(?:ENUM|QUEUE|INT|DATE|STRING|ID)$/;
     $fields{$field} = $field;
 }
 

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


More information about the rt-commit mailing list