summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
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 /Bugzilla/User.pm
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 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm25
1 files changed, 12 insertions, 13 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 02312cc40..ccb73cb66 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -516,26 +516,21 @@ sub save_last_search {
return if !@$bug_ids;
+ my $search;
if ($self->id) {
on_main_db {
- my $search;
if ($list_id) {
- # Use eval so that people can still use old search links or
- # links that don't belong to them.
- $search = eval { Bugzilla::Search::Recent->check(
- { id => $list_id }) };
+ $search = Bugzilla::Search::Recent->check_quietly({ id => $list_id });
}
if ($search) {
- # We only update placeholders. (Placeholders are
- # Saved::Search::Recent objects with empty bug lists.)
- # Otherwise, we could just keep creating new searches
- # for the same refreshed list over and over.
- if (!@{ $search->bug_list }) {
- $search->set_list_order($order);
+ if (join(',', @{$search->bug_list}) ne join(',', @$bug_ids)) {
$search->set_bug_list($bug_ids);
- $search->update();
}
+ if (!$search->list_order || $order ne $search->list_order) {
+ $search->set_list_order($order);
+ }
+ $search->update();
}
else {
# If we already have an existing search with a totally
@@ -548,11 +543,14 @@ sub save_last_search {
user_id => $self->id, bug_list => $list_string });
if (!scalar(@$existing_search)) {
- Bugzilla::Search::Recent->create({
+ $search = Bugzilla::Search::Recent->create({
user_id => $self->id,
bug_list => $bug_ids,
list_order => $order });
}
+ else {
+ $search = $existing_search->[0];
+ }
}
};
delete $self->{recent_searches};
@@ -574,6 +572,7 @@ sub save_last_search {
$vars->{'toolong'} = 1;
}
}
+ return $search;
}
sub settings {