summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-09-11 17:48:48 +0200
committerByron Jones <glob@mozilla.com>2014-09-11 17:49:01 +0200
commit747f1f1cacb06bc19cedd376371e4b3109b2983a (patch)
tree8d30aab742d134da77e64f3709c4d015746ab469
parentcdf7ace8009c37ce5e5c29ed10a6f4f151b47a7a (diff)
downloadbugzilla-747f1f1cacb06bc19cedd376371e4b3109b2983a.tar.gz
bugzilla-747f1f1cacb06bc19cedd376371e4b3109b2983a.tar.xz
Bug 1052851: add the ability to search by "assignee last login date"
-rw-r--r--Bugzilla/Field.pm2
-rw-r--r--Bugzilla/Search.pm26
-rw-r--r--extensions/BugmailFilter/lib/Constants.pm1
-rw-r--r--template/en/default/global/field-descs.none.tmpl1
-rw-r--r--template/en/default/pages/fields.html.tmpl1
5 files changed, 31 insertions, 0 deletions
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm
index 0a26b9320..d5f8e33f9 100644
--- a/Bugzilla/Field.pm
+++ b/Bugzilla/Field.pm
@@ -216,6 +216,8 @@ use constant DEFAULT_FIELDS => (
{name => 'blocked', desc => 'Blocks', in_new_bugmail => 1,
is_numeric => 1, buglist => 1},
+ {name => 'assignee_last_login', desc => 'Assignee Last Login Date', buglist => 1},
+
{name => 'attachments.description', desc => 'Attachment description'},
{name => 'attachments.filename', desc => 'Attachment filename'},
{name => 'attachments.mimetype', desc => 'Attachment mime type'},
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 356af1870..86e6764ff 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -288,6 +288,9 @@ use constant OPERATOR_FIELD_OVERRIDE => {
'attach_data.thedata' => MULTI_SELECT_OVERRIDE,
# We check all attachment fields against this.
attachments => MULTI_SELECT_OVERRIDE,
+ assignee_last_login => {
+ _default => \&_assignee_last_login,
+ },
blocked => MULTI_SELECT_OVERRIDE,
bug_file_loc => { _non_changed => \&_nullable },
bug_group => MULTI_SELECT_OVERRIDE,
@@ -485,6 +488,13 @@ sub COLUMN_JOINS {
table => 'profiles',
join => 'INNER',
},
+ assignee_last_login => {
+ as => 'assignee',
+ from => 'assigned_to',
+ to => 'userid',
+ table => 'profiles',
+ join => 'INNER',
+ },
reporter => {
from => 'reporter',
to => 'userid',
@@ -624,6 +634,7 @@ sub COLUMNS {
'longdescs.count' => 'COUNT(DISTINCT map_longdescs_count.comment_id)',
last_visit_ts => 'bug_user_last_visit.last_visit_ts',
+ assignee_last_login => 'assignee.last_seen_date',
);
# Backward-compatibility for old field names. Goes new_name => old_name.
@@ -2793,6 +2804,21 @@ sub _days_elapsed {
$dbh->sql_to_days('bugs.delta_ts') . ")";
}
+sub _assignee_last_login {
+ my ($self, $args) = @_;
+
+ push @{ $args->{joins} }, {
+ as => 'assignee',
+ table => 'profiles',
+ from => 'assigned_to',
+ to => 'userid',
+ join => 'INNER',
+ };
+ # coalesce to 1998 to make it easy to search for users who haven't logged
+ # in since we added last_seen_date
+ $args->{full_field} = "COALESCE(assignee.last_seen_date, '1998-01-01')";
+}
+
sub _component_nonchanged {
my ($self, $args) = @_;
diff --git a/extensions/BugmailFilter/lib/Constants.pm b/extensions/BugmailFilter/lib/Constants.pm
index ee28427f7..20e5480d0 100644
--- a/extensions/BugmailFilter/lib/Constants.pm
+++ b/extensions/BugmailFilter/lib/Constants.pm
@@ -36,6 +36,7 @@ use constant FAKE_FIELD_NAMES => [
# these fields don't make any sense to filter on
use constant IGNORE_FIELDS => qw(
+ assignee_last_login
attach_data.thedata
attachments.submitter
cf_last_resolved
diff --git a/template/en/default/global/field-descs.none.tmpl b/template/en/default/global/field-descs.none.tmpl
index 721e1dc49..6b365b35f 100644
--- a/template/en/default/global/field-descs.none.tmpl
+++ b/template/en/default/global/field-descs.none.tmpl
@@ -79,6 +79,7 @@
"alias" => "Alias",
"assigned_to" => "Assignee",
"assigned_to_realname" => "Assignee Real Name",
+ "assignee_last_login" => "Assignee Last Login Date",
"attach_data.thedata" => "Attachment data",
"attachments.description" => "Attachment description",
"attachments.filename" => "Attachment filename",
diff --git a/template/en/default/pages/fields.html.tmpl b/template/en/default/pages/fields.html.tmpl
index 6c63d851d..8c763d73f 100644
--- a/template/en/default/pages/fields.html.tmpl
+++ b/template/en/default/pages/fields.html.tmpl
@@ -220,6 +220,7 @@
'owner_idle_time',
'bug_status',
'resolution',
+ 'assignee_last_login',
] %]
<dl class="field_descriptions">