summaryrefslogtreecommitdiffstats
path: root/extensions/MyDashboard/lib
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-01-03 20:41:44 +0100
committerDave Lawrence <dlawrence@mozilla.com>2013-01-03 20:41:44 +0100
commita29bc8846fac5d7bcbe37ed306eb612bfc74acee (patch)
tree20e0b5e7531797d891a912749d068b34903cd7d7 /extensions/MyDashboard/lib
parentf3975a11266aad202f31ce6fe8e86f321c68cd3e (diff)
downloadbugzilla-a29bc8846fac5d7bcbe37ed306eb612bfc74acee.tar.gz
bugzilla-a29bc8846fac5d7bcbe37ed306eb612bfc74acee.tar.xz
More MyDashboard work
Diffstat (limited to 'extensions/MyDashboard/lib')
-rw-r--r--extensions/MyDashboard/lib/Queries.pm4
-rw-r--r--extensions/MyDashboard/lib/WebService.pm27
2 files changed, 29 insertions, 2 deletions
diff --git a/extensions/MyDashboard/lib/Queries.pm b/extensions/MyDashboard/lib/Queries.pm
index 79247bf73..e81e7f73f 100644
--- a/extensions/MyDashboard/lib/Queries.pm
+++ b/extensions/MyDashboard/lib/Queries.pm
@@ -10,6 +10,7 @@ package Bugzilla::Extension::MyDashboard::Queries;
use strict;
use Bugzilla;
+use Bugzilla::Bug;
use Bugzilla::CGI;
use Bugzilla::Search;
use Bugzilla::Util qw(format_time);
@@ -17,6 +18,8 @@ use Bugzilla::Util qw(format_time);
use Bugzilla::Extension::MyDashboard::Util qw(open_states quoted_open_states);
use Bugzilla::Extension::MyDashboard::TimeAgo qw(time_ago);
+use Data::Dumper;
+
use base qw(Exporter);
our @EXPORT = qw(
QUERY_ORDER
@@ -242,5 +245,4 @@ sub query_flags {
return undef;
}
-
1;
diff --git a/extensions/MyDashboard/lib/WebService.pm b/extensions/MyDashboard/lib/WebService.pm
index 853ef2baf..07619e705 100644
--- a/extensions/MyDashboard/lib/WebService.pm
+++ b/extensions/MyDashboard/lib/WebService.pm
@@ -9,7 +9,7 @@ package Bugzilla::Extension::MyDashboard::WebService;
use strict;
use warnings;
-use base qw(Bugzilla::WebService);
+use base qw(Bugzilla::WebService Bugzilla::WebService::Bug);
use Bugzilla::Constants;
use Bugzilla::Error;
@@ -92,6 +92,7 @@ sub prod_comp_search {
sub run_bug_query {
my($self, $params) = @_;
+ my $dbh = Bugzilla->dbh;
my $user = Bugzilla->login(LOGIN_REQUIRED);
defined $params->{query}
@@ -103,6 +104,30 @@ sub run_bug_query {
foreach my $qdef (QUERY_DEFS) {
next if $qdef->{name} ne $params->{query};
my ($bugs, $query_string) = query_bugs($qdef);
+
+ # Add last changes to each bug
+ foreach my $b (@$bugs) {
+ my $last_changes = {};
+ my $activity = $self->history({ ids => [ $b->{bug_id} ],
+ start_time => $b->{changeddate} });
+ if (@{$activity->{bugs}[0]{history}}) {
+ $last_changes->{activity} = $activity->{bugs}[0]{history}[0]{changes};
+ $last_changes->{email} = $activity->{bugs}[0]{history}[0]{who};
+ $last_changes->{when} = $activity->{bugs}[0]{history}[0]{when};
+ }
+ my $last_comment_id = $dbh->selectrow_array("
+ SELECT comment_id FROM longdescs
+ WHERE bug_id = ? AND bug_when >= ?",
+ undef, $b->{bug_id}, $b->{changeddate});
+ if ($last_comment_id) {
+ my $comments = $self->comments({ comment_ids => [ $last_comment_id ] });
+ $last_changes->{comment} = $comments->{comments}{$last_comment_id}{text};
+ $last_changes->{email} = $comments->{comments}{$last_comment_id}{creator} if !$last_changes->{email};
+ $last_changes->{when} = $comments->{comments}{$last_comment_id}{creation_time} if !$last_changes->{when};
+ }
+ $b->{last_changes} = $last_changes;
+ }
+
$query_string =~ s/^POSTDATA=&//;
$qdef->{bugs} = $bugs;
$qdef->{buffer} = $query_string;