summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2010-10-14 02:31:45 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2010-10-14 02:31:45 +0200
commit3e06a51f060f168034ada88e40d9b60d51f8a244 (patch)
tree129362f12d91d4819168cd33e3955c67eb1ac876
parent7995b869843b68a9a163ebcb4ddfc3ab40b27c8c (diff)
downloadbugzilla-3e06a51f060f168034ada88e40d9b60d51f8a244.tar.gz
bugzilla-3e06a51f060f168034ada88e40d9b60d51f8a244.tar.xz
Bug 600598: "Can't call method "bug_list" on unblessed reference" error thrown when editing a bug which is in the BUGLIST cookie but not in a recent saved search, with action="next_bug"
r/a=mkanat
-rw-r--r--Bugzilla/Search/Recent.pm12
-rw-r--r--Bugzilla/User.pm3
2 files changed, 14 insertions, 1 deletions
diff --git a/Bugzilla/Search/Recent.pm b/Bugzilla/Search/Recent.pm
index 6e24bd5bc..d7d595ecc 100644
--- a/Bugzilla/Search/Recent.pm
+++ b/Bugzilla/Search/Recent.pm
@@ -90,6 +90,18 @@ sub check {
return $search;
}
+sub new_from_cookie {
+ my ($invocant, $bug_ids) = @_;
+ my $class = ref($invocant) || $invocant;
+
+ my $search = { id => 'cookie',
+ user_id => Bugzilla->user->id,
+ bug_list => join(',', @$bug_ids) };
+
+ bless $search, $class;
+ return $search;
+}
+
####################
# Simple Accessors #
####################
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 1dc03a9c7..bf0a9e7e9 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -425,7 +425,8 @@ sub recent_search_for {
if (my $list = $cgi->cookie('BUGLIST')) {
my @bug_ids = split(':', $list);
if (grep { $_ == $bug->id } @bug_ids) {
- return { id => 'cookie', bug_list => \@bug_ids };
+ my $search = Bugzilla::Search::Recent->new_from_cookie(\@bug_ids);
+ return $search;
}
}