summaryrefslogtreecommitdiffstats
path: root/extensions/MyDashboard
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-11-07 21:01:04 +0100
committerDave Lawrence <dlawrence@mozilla.com>2013-11-07 21:01:04 +0100
commitd33dd701c30e2845f4da9a604d24cf23a5dd9c5c (patch)
tree26b18dd40a7aefebf4b8a690604d5193c934c946 /extensions/MyDashboard
parenta81cbfc4e9b3e5b5462bc50618791cd45c9882ef (diff)
downloadbugzilla-d33dd701c30e2845f4da9a604d24cf23a5dd9c5c.tar.gz
bugzilla-d33dd701c30e2845f4da9a604d24cf23a5dd9c5c.tar.xz
Bug 936049 - MyDashboard display of last change for a bug no longer working due to API change for Bug.history
Diffstat (limited to 'extensions/MyDashboard')
-rw-r--r--extensions/MyDashboard/lib/WebService.pm14
1 files changed, 9 insertions, 5 deletions
diff --git a/extensions/MyDashboard/lib/WebService.pm b/extensions/MyDashboard/lib/WebService.pm
index 6c8879657..a43aa97ab 100644
--- a/extensions/MyDashboard/lib/WebService.pm
+++ b/extensions/MyDashboard/lib/WebService.pm
@@ -13,7 +13,7 @@ use base qw(Bugzilla::WebService Bugzilla::WebService::Bug);
use Bugzilla::Constants;
use Bugzilla::Error;
-use Bugzilla::Util qw(detaint_natural trick_taint template_var);
+use Bugzilla::Util qw(detaint_natural trick_taint template_var datetime_from);
use Bugzilla::WebService::Util qw(validate);
use Bugzilla::Extension::MyDashboard::Queries qw(QUERY_DEFS query_bugs query_flags);
@@ -41,8 +41,12 @@ sub run_bug_query {
# Add last changes to each bug
foreach my $b (@$bugs) {
my $last_changes = {};
- my $activity = $self->history({ ids => [ $b->{bug_id} ],
- new_since => $b->{changeddate} });
+ # Remove one second so we get the changes made at $change_date (>=)
+ my $changed_date = datetime_from($b->{changeddate});
+ next if !$changed_date;
+ $changed_date->subtract(seconds => 1);
+ my $activity = $self->history({ ids => [ $b->{bug_id} ],
+ new_since => $changed_date });
if (@{$activity->{bugs}[0]{history}}) {
my $change_set = $activity->{bugs}[0]{history}[0];
$last_changes->{activity} = $change_set->{changes};
@@ -55,8 +59,8 @@ sub run_bug_query {
}
my $last_comment_id = $dbh->selectrow_array("
SELECT comment_id FROM longdescs
- WHERE bug_id = ? AND bug_when >= ?",
- undef, $b->{bug_id}, $b->{changeddate});
+ WHERE bug_id = ? AND bug_when > ?",
+ undef, $b->{bug_id}, $changed_date);
if ($last_comment_id) {
my $comments = $self->comments({ comment_ids => [ $last_comment_id ] });
my $comment = $comments->{comments}{$last_comment_id};