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

Brian Duggan brian at bestpractical.com
Tue Jan 2 16:41:36 EST 2018


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

- Log -----------------------------------------------------------------
commit 92a309753bebcd4fb9be9ae8ecb43df155735a04
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 dbe9099..2d28e46 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 test => 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,77 @@ 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');
+
+    for my $idx (0.. at scraped_orderbys-1) {
+	if ($idx == 0) {
+	    is ($scraped_orderbys[$idx], $orderby);
+	} else {
+	    is ($scraped_orderbys[$idx], '[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("SavedSearchId" => "new");
+    $agent->field("ValueOfQueue", "General");
+    $agent->field("AddClause", "Add these termes");
+    $agent->submit;
+
+    push @orderby, 'CustomField.{Location}';
+
+    $orderby = join(' ', sort @orderby);
+
+    @scraped_orderbys = $agent->scrape_text_by_attr('name', 'OrderBy');
+
+    for my $idx (0.. at scraped_orderbys-1) {
+	if ($idx == 0) {
+	    is ($scraped_orderbys[$idx], $orderby);
+	} else {
+	    is ($scraped_orderbys[$idx], '[none] '.$orderby);
+	}
+    }
+
+    $cf->SetDisabled(1);
+}

commit 8edd604e04391249d31170d8cb1b6ef00911af49
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 4853e17..8b64671 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