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

Brian Duggan brian at bestpractical.com
Tue Dec 12 11:52:28 EST 2017


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

- Log -----------------------------------------------------------------
commit 9c883656591bcb2899fc6b0ecc3c86604ad13471
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 core sortable ticket values in the 'Order by'
    dropdown in search builder.
    
    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/search_orderby.t b/t/web/search_orderby.t
new file mode 100644
index 0000000..d46f14a
--- /dev/null
+++ b/t/web/search_orderby.t
@@ -0,0 +1,70 @@
+use strict;
+use warnings;
+
+use RT::Test tests => 9;
+
+my ( $baseurl, $m ) = RT::Test->started_ok;
+
+ok( $m->login, 'logged in' );
+
+$m->get_ok('Search/Build.html?NewQuery=1');
+
+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 $cf1 = RT::Test->load_or_create_custom_field(
+                      Name  => 'Location',
+                      Queue => 'General',
+                      Type  => 'FreeformSingle', );
+isa_ok( $cf1, 'RT::CustomField' );
+
+my $scraped_orderby = $m->scrape_text_by_attr('name', 'OrderBy');
+
+is($scraped_orderby, $orderby);
+
+$m->submit_form_ok(
+    {
+        form_number => 3,
+        fields => {
+            SavedSearchId => 'new',
+            ValueOfQueue => 'General',
+            AddClause => 'Add these terms',
+        }
+    },
+    'Add these terms',
+    );
+
+$scraped_orderby = $m->scrape_text_by_attr('name', 'OrderBy');
+
+push @orderby, 'CustomField.{Location}';
+
+$orderby = join(' ', sort @orderby);
+
+is($scraped_orderby, $orderby);

commit 913d74da330cf83a2eb4e3ed5463588503a8c4db
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