summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2011-12-15 00:18:12 +0100
committerDave Lawrence <dlawrence@mozilla.com>2011-12-15 00:18:12 +0100
commit15e4810e7986b3b631320da6f20925888b7c923c (patch)
treeab65c7e9dfdc09fe53a727b75bf1b74ffd975212 /Bugzilla/User.pm
parent6b9320eab2e848a2b2ac2f454af939f467f3d738 (diff)
parenta6aa75fc6f96527f01e8b4f0da414d9fa8ad8ce1 (diff)
downloadbugzilla-15e4810e7986b3b631320da6f20925888b7c923c.tar.gz
bugzilla-15e4810e7986b3b631320da6f20925888b7c923c.tar.xz
merged with bugzilla/4.2
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 5b4f9a814..c1c364fd9 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -517,26 +517,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
@@ -549,11 +544,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};
@@ -575,6 +573,7 @@ sub save_last_search {
$vars->{'toolong'} = 1;
}
}
+ return $search;
}
sub settings {