summaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-12-09 00:12:04 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2011-12-09 00:12:04 +0100
commit49445ac5eb1b8f0b44f29942e2ea1e941dff4807 (patch)
tree621d845d31e81e950fd28c7e37799655d43b14b6 /buglist.cgi
parent485094e00a0c2ae09d79858963e94fabcdf9689d (diff)
downloadbugzilla-49445ac5eb1b8f0b44f29942e2ea1e941dff4807.tar.gz
bugzilla-49445ac5eb1b8f0b44f29942e2ea1e941dff4807.tar.xz
Bug 644281: When the sort order of a buglist is modified, the "Show next bug in my list" user pref still uses the original sort order to decide which bug to display next
r=glob a=LpSolit
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi31
1 files changed, 13 insertions, 18 deletions
diff --git a/buglist.cgi b/buglist.cgi
index f9c9a7720..6e3793229 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -164,14 +164,13 @@ my $params;
# If the user is retrieving the last bug list they looked at, hack the buffer
# storing the query string so that it looks like a query retrieving those bugs.
if (my $last_list = $cgi->param('regetlastlist')) {
- my ($bug_ids, $order);
+ my $bug_ids;
# Logged-out users use the old cookie method for storing the last search.
if (!$user->id or $last_list eq 'cookie') {
- $cgi->cookie('BUGLIST') || ThrowUserError("missing_cookie");
- $order = "reuse last sort" unless $order;
- $bug_ids = $cgi->cookie('BUGLIST');
+ $bug_ids = $cgi->cookie('BUGLIST') or ThrowUserError("missing_cookie");
$bug_ids =~ s/[:-]/,/g;
+ $order ||= "reuse last sort";
}
# But logged in users store the last X searches in the DB so they can
# have multiple bug lists available.
@@ -179,10 +178,11 @@ if (my $last_list = $cgi->param('regetlastlist')) {
my $last_search = Bugzilla::Search::Recent->check(
{ id => $last_list });
$bug_ids = join(',', @{ $last_search->bug_list });
- $order = $last_search->list_order if !$order;
+ $order ||= $last_search->list_order;
}
# set up the params for this new query
$params = new Bugzilla::CGI({ bug_id => $bug_ids, order => $order });
+ $params->param('list_id', $last_list);
}
# Figure out whether or not the user is doing a fulltext search. If not,
@@ -952,14 +952,6 @@ if ($format->{'extension'} eq 'ics') {
}
}
-# The list of query fields in URL query string format, used when creating
-# URLs to the same query results page with different parameters (such as
-# a different sort order or when taking some action on the set of query
-# results). To get this string, we call the Bugzilla::CGI::canoncalise_query
-# function with a list of elements to be removed from the URL.
-$vars->{'urlquerypart'} = $params->canonicalise_query('order',
- 'cmdtype',
- 'query_based_on');
$vars->{'order'} = $order;
$vars->{'caneditbugs'} = 1;
$vars->{'time_info'} = $time_info;
@@ -1093,17 +1085,20 @@ my $contenttype;
my $disposition = "inline";
if ($format->{'extension'} eq "html" && !$agent) {
- if (!$cgi->param('regetlastlist')) {
- Bugzilla->user->save_last_search(
- { bugs => \@bugidlist, order => $order, vars => $vars,
- list_id => scalar $cgi->param('list_id') });
- }
+ my $list_id = $cgi->param('list_id') || $cgi->param('regetlastlist');
+ my $search = $user->save_last_search(
+ { bugs => \@bugidlist, order => $order, vars => $vars, list_id => $list_id });
+ $cgi->param('list_id', $search->id) if $search;
$contenttype = "text/html";
}
else {
$contenttype = $format->{'ctype'};
}
+# Set 'urlquerypart' once the buglist ID is known.
+$vars->{'urlquerypart'} = $params->canonicalise_query('order', 'cmdtype',
+ 'query_based_on');
+
if ($format->{'extension'} eq "csv") {
# We set CSV files to be downloaded, as they are designed for importing
# into other programs.