aboutsummaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi39
1 files changed, 37 insertions, 2 deletions
diff --git a/buglist.cgi b/buglist.cgi
index daee34c9b..6e5e3d94c 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -858,9 +858,44 @@ if (@bugidlist) {
while (my ($bug_id, $min_membercontrol) = $sth->fetchrow_array()) {
$min_membercontrol{$bug_id} = $min_membercontrol || CONTROLMAPNA;
}
+
+ my $involved_bugs = {};
+ my $involved_new_bugs = {};
+
+ if ($user->id) {
+ $involved_bugs =
+ $dbh->selectall_hashref('SELECT bugs.bug_id, CASE WHEN last_visit_ts < delta_ts THEN 1 ELSE 0 END AS updated
+ FROM bugs
+ INNER JOIN bug_user_last_visit
+ ON bugs.bug_id = bug_user_last_visit.bug_id
+ WHERE user_id = ?
+ AND ' . $dbh->sql_in('bugs.bug_id', \@bugidlist),
+ 'bug_id', undef, $user->id);
+
+ my ($new_bugs) = diff_arrays(\@bugidlist, [keys %$involved_bugs]);
+ if (@$new_bugs) {
+ my $involved_new_bugs_list =
+ $dbh->selectcol_arrayref('SELECT bugs.bug_id
+ FROM bugs
+ LEFT JOIN cc
+ ON cc.bug_id = bugs.bug_id
+ WHERE (reporter = ? OR assigned_to = ? OR qa_contact = ? OR who = ?)
+ AND ' . $dbh->sql_in('bugs.bug_id', $new_bugs),
+ undef, ($user->id) x 4);
+ %$involved_new_bugs = map { $_ => 1 } @$involved_new_bugs_list;
+ }
+ }
+
foreach my $bug (@bugs) {
- next unless defined($min_membercontrol{$bug->{'bug_id'}});
- if ($min_membercontrol{$bug->{'bug_id'}} == CONTROLMAPMANDATORY) {
+ my $bug_id = $bug->{bug_id};
+ if (my $involved_bug = $involved_bugs->{$bug_id}) {
+ $bug->{last_visit_status} = $involved_bug->{updated} ? 'updated' : 'up_to_date';
+ }
+ elsif ($user->id) {
+ $bug->{last_visit_status} = $involved_new_bugs->{$bug_id} ? 'new' : 'unknown';
+ }
+ next unless defined $min_membercontrol{$bug_id};
+ if ($min_membercontrol{$bug_id} == CONTROLMAPMANDATORY) {
$bug->{'secure_mode'} = 'implied';
}
else {