aboutsummaryrefslogtreecommitdiffstats
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
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
-rwxr-xr-xbuglist.cgi39
-rw-r--r--skins/standard/buglist.css32
-rw-r--r--template/en/default/list/list.html.tmpl17
-rw-r--r--template/en/default/list/table.html.tmpl1
4 files changed, 87 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 {
diff --git a/skins/standard/buglist.css b/skins/standard/buglist.css
index e58baabfd..7256d285e 100644
--- a/skins/standard/buglist.css
+++ b/skins/standard/buglist.css
@@ -118,6 +118,38 @@ tr.bz_secure_mode_implied td.first-child {
tr.bz_secure_mode_manual td.first-child {
}
+div.bz_last_visit_description {
+ padding: 1em 0;
+}
+div.bz_last_visit_description span {
+ padding-left: 1em;
+ white-space: nowrap;
+}
+tr.bz_new_since_last_visit td.first-child:before,
+span.bz_new_since_last_visit:before {
+ color: #ed2;
+ content: "\25CF";
+ font-size: large;
+}
+tr.bz_updated_since_last_visit td.first-child:before,
+span.bz_updated_since_last_visit:before {
+ color: #c00;
+ content: "\25CF";
+ font-size: large;
+}
+tr.bz_up_to_date_since_last_visit td.first-child:before,
+span.bz_up_to_date_since_last_visit:before {
+ color: #0c0;
+ content: "\25CF";
+ font-size: large;
+}
+tr.bz_unknown_since_last_visit td.first-child:before,
+span.bz_unknown_since_last_visit:before {
+ color: #aaa;
+ content: "\25CF";
+ font-size: large;
+}
+
td.bz_estimated_time_column,
td.bz_remaining_time_column,
td.bz_actual_time_column,
diff --git a/template/en/default/list/list.html.tmpl b/template/en/default/list/list.html.tmpl
index 368cd9c08..63866f416 100644
--- a/template/en/default/list/list.html.tmpl
+++ b/template/en/default/list/list.html.tmpl
@@ -131,6 +131,23 @@
[% END %]
</li>
[% END %]
+
+[% IF user.id AND bugs.size %]
+ <div class="bz_last_visit_description">
+ <span class="bz_new_since_last_visit">
+ [% terms.Bugs %] you are involved in, but which you never visited or did not visit in the last [% Param('last_visit_keep_days') %] days
+ </span>
+ <span class="bz_updated_since_last_visit">
+ [% terms.Bugs %] you are involved in, which have been updated since your last visit
+ </span>
+ <span class="bz_up_to_date_since_last_visit">
+ [% terms.Bugs %] you are involved in, which got no updates since your last visit
+ </span>
+ <span class="bz_unknown_since_last_visit">
+ [% terms.Bugs %] you are not involved in
+ </span>
+ </div>
+[% END %]
</ul>
<hr>
diff --git a/template/en/default/list/table.html.tmpl b/template/en/default/list/table.html.tmpl
index d3abc9b21..7e6611109 100644
--- a/template/en/default/list/table.html.tmpl
+++ b/template/en/default/list/table.html.tmpl
@@ -168,6 +168,7 @@
[%+ "bz_$bug.resolution" FILTER css_class_quote IF bug.resolution -%]
[%+ "bz_secure" IF bug.secure_mode -%]
[%+ "bz_secure_mode_$bug.secure_mode" FILTER css_class_quote IF bug.secure_mode -%]
+ [%+ "bz_${bug.last_visit_status}_since_last_visit" IF bug.last_visit_status %]
[%+ count % 2 == 1 ? "bz_row_odd" : "bz_row_even" -%]
">