summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Bug.pm
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-07-25 06:21:06 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-07-25 06:21:06 +0200
commit3331c1bafae2fcaf511db95a0e2b79ab65e25bfe (patch)
treeef00cceb2667187de4d01f423715abf6e4933c46 /Bugzilla/WebService/Bug.pm
parent300331b456392d054f6a85a98aa6a5c56bc37f9b (diff)
downloadbugzilla-3331c1bafae2fcaf511db95a0e2b79ab65e25bfe.tar.gz
bugzilla-3331c1bafae2fcaf511db95a0e2b79ab65e25bfe.tar.xz
Bug 1161070: api searches should honour the same fields in its "order" parameter as the web UI
r=dylan,a=simon
Diffstat (limited to 'Bugzilla/WebService/Bug.pm')
-rw-r--r--Bugzilla/WebService/Bug.pm20
1 files changed, 19 insertions, 1 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 47c047745..c6b28a9a0 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -575,7 +575,25 @@ sub search {
ThrowUserError('buglist_parameters_required');
}
- $options{order} = [ split(/\s*,\s*/, delete $match_params->{order}) ] if $match_params->{order};
+ # Allow the use of order shortcuts similar to web UI
+ if ($match_params->{order}) {
+ # Convert the value of the "order" form field into a list of columns
+ # by which to sort the results.
+ my %order_types = (
+ "Bug Number" => [ "bug_id" ],
+ "Importance" => [ "priority", "bug_severity" ],
+ "Assignee" => [ "assigned_to", "bug_status", "priority", "bug_id" ],
+ "Last Changed" => [ "changeddate", "bug_status", "priority",
+ "assigned_to", "bug_id" ],
+ );
+ if ($order_types{$match_params->{order}}) {
+ $options{order} = $order_types{$match_params->{order}};
+ }
+ else {
+ $options{order} = [ split(/\s*,\s*/, $match_params->{order}) ];
+ }
+ }
+
$options{params} = $match_params;
my $search = new Bugzilla::Search(%options);