summaryrefslogtreecommitdiffstats
path: root/extensions/MyDashboard/lib
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-03-21 20:57:53 +0100
committerDave Lawrence <dlawrence@mozilla.com>2013-03-21 20:57:53 +0100
commit897f58ced15e63ca63e870a40991eaf97de84f2f (patch)
treec82b8104c7f3f4e0860f98cc0381f7cd5db5f1d0 /extensions/MyDashboard/lib
parenta64fdeb4ee2ce3d3757f9bdd87def70d1e82036e (diff)
downloadbugzilla-897f58ced15e63ca63e870a40991eaf97de84f2f.tar.gz
bugzilla-897f58ced15e63ca63e870a40991eaf97de84f2f.tar.xz
Bug 853432 - "Flags requested of you" doesn't show flags that are requested on Resolved bugs
Diffstat (limited to 'extensions/MyDashboard/lib')
-rw-r--r--extensions/MyDashboard/lib/Queries.pm32
-rw-r--r--extensions/MyDashboard/lib/WebService.pm12
2 files changed, 24 insertions, 20 deletions
diff --git a/extensions/MyDashboard/lib/Queries.pm b/extensions/MyDashboard/lib/Queries.pm
index e8813989b..5a3bf0cc6 100644
--- a/extensions/MyDashboard/lib/Queries.pm
+++ b/extensions/MyDashboard/lib/Queries.pm
@@ -161,7 +161,7 @@ sub query_bugs {
}
sub query_flags {
- my $type = shift;
+ my ($type, $include_resolved) = @_;
my $user = Bugzilla->user;
my $dbh = Bugzilla->dbh;
my $date_now = DateTime->now;
@@ -174,20 +174,20 @@ sub query_flags {
$attach_join_clause .= " AND attachments.isprivate < 1";
}
- my $query =
+ my $query =
# Select columns describing each flag, the bug/attachment on which
# it has been set, who set it, and of whom they are requesting it.
- " SELECT flags.id AS id,
+ " SELECT flags.id AS id,
flagtypes.name AS type,
flags.status AS status,
- flags.bug_id AS bug_id,
+ flags.bug_id AS bug_id,
bugs.bug_status AS bug_status,
bugs.short_desc AS bug_summary,
- flags.attach_id AS attach_id,
+ flags.attach_id AS attach_id,
attachments.description AS attach_summary,
- requesters.login_name AS requester,
+ requesters.login_name AS requester,
requestees.login_name AS requestee,
- " . $dbh->sql_date_format('flags.creation_date', '%Y-%m-%d %H:%i') . " AS created
+ " . $dbh->sql_date_format('flags.modification_date', '%Y-%m-%d %H:%i') . " AS updated
FROM flags
LEFT JOIN attachments
ON ($attach_join_clause)
@@ -206,8 +206,12 @@ sub query_flags {
AND ccmap.bug_id = bugs.bug_id ";
# Limit query to pending requests and open bugs only
- $query .= " WHERE bugs.bug_status IN (" . join(',', quoted_open_states()) . ")
- AND flags.status = '?' ";
+ $query .= " WHERE flags.status = '?' ";
+
+ # Limit to open bugs only unless want to include resolved
+ if (!$include_resolved) {
+ $query .= " AND bugs.bug_status IN (" . join(',', quoted_open_states()) . ") ";
+ }
# Weed out bug the user does not have access to
$query .= " AND ((bgmap.group_id IS NULL)
@@ -221,7 +225,7 @@ sub query_flags {
$query .= ") ";
# Order the records (within each group).
- my $group_order_by = " GROUP BY flags.bug_id ORDER BY flags.creation_date, flagtypes.name";
+ my $group_order_by = " GROUP BY flags.bug_id ORDER BY flags.modification_date, flagtypes.name";
my $flags = [];
if ($type eq 'requestee') {
@@ -238,11 +242,11 @@ sub query_flags {
{ Slice => {} }, $user->login);
}
- # Format the created date specific to the user's timezone and add the fancy version
+ # Format the updated date specific to the user's timezone and add the fancy version
foreach my $flag (@$flags) {
- $flag->{'created'} = format_time($flag->{'created'}, '%Y-%m-%d %H:%M');
- my $date_then = datetime_from($flag->{'created'});
- $flag->{'created_fancy'} = time_ago($date_then, $date_now);
+ $flag->{'updated'} = format_time($flag->{'updated'}, '%Y-%m-%d %H:%M');
+ my $date_then = datetime_from($flag->{'updated'});
+ $flag->{'updated_fancy'} = time_ago($date_then, $date_now);
}
return $flags;
diff --git a/extensions/MyDashboard/lib/WebService.pm b/extensions/MyDashboard/lib/WebService.pm
index 1f3b7ce06..1a9c212f4 100644
--- a/extensions/MyDashboard/lib/WebService.pm
+++ b/extensions/MyDashboard/lib/WebService.pm
@@ -82,13 +82,13 @@ sub run_flag_query {
my ($self, $params) =@_;
my $user = Bugzilla->login(LOGIN_REQUIRED);
- defined $params->{type}
- || ThrowCodeError('param_required',
- { function => 'MyDashboard.run_flag_query',
- param => 'type' });
-
my $type = $params->{type};
- my $results = query_flags($type);
+ $type || ThrowCodeError('param_required',
+ { function => 'MyDashboard.run_flag_query',
+ param => 'type' });
+
+ my $include_resolved = $params->{include_resolved} || 0;
+ my $results = query_flags($type, $include_resolved);
return { result => { $type => $results }};
}