diff options
author | Yorhel <git@yorhel.nl> | 2009-10-10 15:51:57 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-10-10 15:51:57 +0200 |
commit | 5ce2ce4c494feef5940c032549472a52b5282ad1 (patch) | |
tree | 89efb88dc1fc0afbb2d4ba3b29a37e154453edeb /lib/VNDB/Handler/Discussions.pm | |
parent | 1e125f67ab50a5de477c538b3f7dd27a9ec3c62f (diff) |
Display number of unread posts in user menu
Instead of displaying the total number of threads. Posts are marked as
read when the thread is opened.
Diffstat (limited to 'lib/VNDB/Handler/Discussions.pm')
-rw-r--r-- | lib/VNDB/Handler/Discussions.pm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/VNDB/Handler/Discussions.pm b/lib/VNDB/Handler/Discussions.pm index 1d74ac6a..5fedaeed 100644 --- a/lib/VNDB/Handler/Discussions.pm +++ b/lib/VNDB/Handler/Discussions.pm @@ -29,6 +29,11 @@ sub thread { my $p = $self->dbPostGet(tid => $tid, results => 25, page => $page, what => 'user'); return 404 if !$p->[0]; + # mark as read when this thread is posted in the board of the currently logged in user + my $uid = $self->authInfo->{id}; + $self->dbPostRead($t->{id}, $uid, $p->[$#$p]{num}) + if $uid && grep $_->{type} eq 'u' && $_->{iid} == $uid, @{$t->{boards}}; + $self->htmlHeader(title => $t->{title}); div class => 'mainbox'; |