aboutsummaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@netscape.net>2017-04-18 23:04:40 +0200
committerFrédéric Buclin <LpSolit@netscape.net>2017-04-18 23:04:40 +0200
commit67f7d865283a0463b829a2d1d46941c86e10f391 (patch)
tree9e18f3da34100170f61bc5bea6aa16850187e560 /buglist.cgi
parentaa57f25e629ad052b33d66635e5430d34f4c5f81 (diff)
downloadbugs-67f7d865283a0463b829a2d1d46941c86e10f391.tar
bugs-67f7d865283a0463b829a2d1d46941c86e10f391.tar.gz
bugs-67f7d865283a0463b829a2d1d46941c86e10f391.tar.bz2
bugs-67f7d865283a0463b829a2d1d46941c86e10f391.tar.xz
bugs-67f7d865283a0463b829a2d1d46941c86e10f391.zip
Implement a UI in the buglist for the last visit time
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 {