From 747f1f1cacb06bc19cedd376371e4b3109b2983a Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 11 Sep 2014 23:48:48 +0800 Subject: Bug 1052851: add the ability to search by "assignee last login date" --- Bugzilla/Search.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Bugzilla/Search.pm') 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) = @_; -- cgit v1.2.3-24-g4f1b