From 5203d56cf8ce668d31207ef87b6db805a00d3493 Mon Sep 17 00:00:00 2001 From: Kohei Yoshino Date: Thu, 28 Mar 2019 23:16:21 -0400 Subject: [PATCH] Bug 1481106 - Start logging bug_user_last_visit for all visited bugs even if the user is not involved --- Bugzilla/Bug.pm | 11 ----------- Bugzilla/WebService/BugUserLastVisit.pm | 3 +-- Bugzilla/WebService/Constants.pm | 3 --- .../template/en/default/bug_modal/header.html.tmpl | 2 +- template/en/default/bug/show-header.html.tmpl | 2 +- template/en/default/global/user-error.html.tmpl | 5 ----- 6 files changed, 3 insertions(+), 23 deletions(-) diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 4e6bfa8fb..ac96a7729 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1399,17 +1399,6 @@ sub update { $self->{delta_ts} = $delta_ts; } - # Update last-visited - if ($user->is_involved_in_bug($self)) { - $self->update_user_last_visit($user, $delta_ts); - } - - # If a user is no longer involved, remove their last visit entry - my $last_visits = Bugzilla::BugUserLastVisit->match({bug_id => $self->id}); - foreach my $lv (@$last_visits) { - $lv->remove_from_db() unless $lv->user->is_involved_in_bug($self); - } - # Update bug ignore data if user wants to ignore mail for this bug if (exists $self->{'bug_ignored'}) { my $bug_ignored_changed; diff --git a/Bugzilla/WebService/BugUserLastVisit.pm b/Bugzilla/WebService/BugUserLastVisit.pm index 9b4261bc3..62a02505e 100644 --- a/Bugzilla/WebService/BugUserLastVisit.pm +++ b/Bugzilla/WebService/BugUserLastVisit.pm @@ -44,8 +44,7 @@ sub update { foreach my $bug_id (@$ids) { my $bug = Bugzilla::Bug->check({id => $bug_id, cache => 1}); - ThrowUserError('user_not_involved', {bug_id => $bug->id}) - unless $user->is_involved_in_bug($bug); + next unless $user->can_see_bug($bug->id); $bug->update_user_last_visit($user, $last_visit_ts); diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm index cb44aae85..d1b1b52f8 100644 --- a/Bugzilla/WebService/Constants.pm +++ b/Bugzilla/WebService/Constants.pm @@ -219,9 +219,6 @@ use constant WS_ERROR_CODE => { # Search errors are 1000-1100 buglist_parameters_required => 1000, - # BugUserLastVisited errors - user_not_involved => 1300, - # Job queue errors 1400-1500 jobqueue_status_error => 1400, diff --git a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl index 675082a50..cbc3acd5b 100644 --- a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl @@ -83,7 +83,7 @@ [% END %] [%# update last-visited %] - [% IF user.id && user.is_involved_in_bug(bug) %] + [% IF user.id %] document.addEventListener('DOMContentLoaded', () => show_new_changes_indicator(), { once: true }); [% END %] diff --git a/template/en/default/bug/show-header.html.tmpl b/template/en/default/bug/show-header.html.tmpl index 560b6179d..2c8ac8f4e 100644 --- a/template/en/default/bug/show-header.html.tmpl +++ b/template/en/default/bug/show-header.html.tmpl @@ -67,7 +67,7 @@ YAHOO.util.Event.onDOMReady(function() { initDirtyFieldTracking(); - [% IF user.id AND user.is_involved_in_bug(bug) %] + [% IF user.id %] YAHOO.bugzilla.bugUserLastVisit.update([ [% bug.bug_id FILTER none %] ]); [% END %] }); diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 3bdb5c6a8..fb45ba784 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -1912,11 +1912,6 @@ Sorry, but you are not allowed to (un)mark comments or attachments as private. - [% ELSIF error == "user_not_involved" %] - [% title = "User Not Involved with $terms.Bug" %] - Sorry, but you are not involved with [% terms.Bug %] [%+ - bug_id FILTER bug_link(bug_id) FILTER none %]. - [% ELSIF error == "webdot_too_large" %] [% title = "Dependency Graph Too Large" %] The dependency graph contains too many [% terms.bugs %] to display (more -- 2.47.3