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

Brian Duggan brian at bestpractical.com
Tue Dec 12 10:13:05 EST 2017


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

- Log -----------------------------------------------------------------
commit e3225bfa4c20e86b6db4d79ce63dbbb1d22a85cd
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Mon Dec 11 22:01:09 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..472daa2
--- /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 ac08b5fff4d67e769769c578c327557dda5c68d7
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