summaryrefslogtreecommitdiffstats
path: root/Bugzilla/API
diff options
context:
space:
mode:
authorDylan Hardison <dylan@mozilla.com>2015-12-10 21:23:57 +0100
committerDylan Hardison <dylan@mozilla.com>2015-12-10 21:24:22 +0100
commit6abbd9dea1d47ef9a4659ac948eeb5120d0da11c (patch)
tree563cc9b8b5f1d546bf1ee7ffbc0699e22f7f1c0a /Bugzilla/API
parentb53cf20261f7905d20a00f11b01ab44504a9bd08 (diff)
downloadbugzilla-6abbd9dea1d47ef9a4659ac948eeb5120d0da11c.tar.gz
bugzilla-6abbd9dea1d47ef9a4659ac948eeb5120d0da11c.tar.xz
Bug 1169181 - The bug_user_last_visit method returns an empty array for old bugs
r=dkl
Diffstat (limited to 'Bugzilla/API')
-rw-r--r--Bugzilla/API/1_0/Resource/BugUserLastVisit.pm26
1 files changed, 11 insertions, 15 deletions
diff --git a/Bugzilla/API/1_0/Resource/BugUserLastVisit.pm b/Bugzilla/API/1_0/Resource/BugUserLastVisit.pm
index fd25524f9..1d2d4f582 100644
--- a/Bugzilla/API/1_0/Resource/BugUserLastVisit.pm
+++ b/Bugzilla/API/1_0/Resource/BugUserLastVisit.pm
@@ -86,7 +86,7 @@ sub update {
push(
@results,
- $self->_bug_user_last_visit_to_hash(
+ _bug_user_last_visit_to_hash(
$bug, $last_visit_ts, $params
));
}
@@ -102,31 +102,27 @@ sub get {
$user->login(LOGIN_REQUIRED);
+ my @last_visits;
if ($ids) {
# Cache permissions for bugs. This highly reduces the number of calls to
# the DB. visible_bugs() is only able to handle bug IDs, so we have to
# skip aliases.
$user->visible_bugs([grep /^[0-9]$/, @$ids]);
- }
-
- my @last_visits = @{ $user->last_visited };
- if ($ids) {
- # remove bugs that we are not interested in if ids is passed in.
- my %id_set = map { ($_ => 1) } @$ids;
- @last_visits = grep { $id_set{ $_->bug_id } } @last_visits;
+ my %last_visit = map { $_->bug_id => $_->last_visit_ts } @{ $user->last_visited($ids) };
+ @last_visits = map { _bug_user_last_visit_to_hash($_, $last_visit{$_}, $params) } @$ids;
+ }
+ else {
+ @last_visits = map {
+ _bug_user_last_visit_to_hash($_->bug_id, $_->last_visit_ts, $params)
+ } @{ $user->last_visited };
}
- return [
- map {
- $self->_bug_user_last_visit_to_hash($_->bug_id, $_->last_visit_ts,
- $params)
- } @last_visits
- ];
+ return \@last_visits;
}
sub _bug_user_last_visit_to_hash {
- my ($self, $bug_id, $last_visit_ts, $params) = @_;
+ my ($bug_id, $last_visit_ts, $params) = @_;
my %result = (id => as_int($bug_id),
last_visit_ts => as_datetime($last_visit_ts));