diff options
author | Dylan William Hardison [:dylan] <dylan@mozilla.com> | 2014-06-03 09:57:28 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-06-03 09:57:28 +0200 |
commit | 1fbae4ef5a9cca5d889a6fed3b930c1c9d641d6e (patch) | |
tree | 7145c2d59544d11556cf1817227e7c725d22be10 /Bugzilla/Bug.pm | |
parent | c725b6c20ae8157a3a13674755b2de5148a1fe26 (diff) | |
download | bugzilla-1fbae4ef5a9cca5d889a6fed3b930c1c9d641d6e.tar.gz bugzilla-1fbae4ef5a9cca5d889a6fed3b930c1c9d641d6e.tar.xz |
Bug 1000917: Backport upstream bug 489028 to bmo/4.2 to allow user last visit searching
Diffstat (limited to 'Bugzilla/Bug.pm')
-rw-r--r-- | Bugzilla/Bug.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 344939333..fe259be27 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -50,6 +50,7 @@ use Bugzilla::Group; use Bugzilla::Status; use Bugzilla::Comment; use Bugzilla::BugUrl; +use Bugzilla::BugUserLastVisit; use List::MoreUtils qw(firstidx uniq part); use List::Util qw(min max first); @@ -4143,6 +4144,23 @@ sub LogActivityEntry { } } +# Update bug_user_last_visit table +sub update_user_last_visit { + my ($self, $user, $last_visit_ts) = @_; + my $lv = Bugzilla::BugUserLastVisit->match({ bug_id => $self->id, + user_id => $user->id })->[0]; + + if ($lv) { + $lv->set(last_visit_ts => $last_visit_ts); + $lv->update; + } + else { + Bugzilla::BugUserLastVisit->create({ bug_id => $self->id, + user_id => $user->id, + last_visit_ts => $last_visit_ts }); + } +} + # Convert WebService API and email_in.pl field names to internal DB field # names. sub map_fields { |