summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Discussions
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-04-13 12:43:41 +0200
committerYorhel <git@yorhel.nl>2020-04-13 12:44:11 +0200
commit3d1b51a37e21cc30c3f1f0794fadc0d929a4d6ba (patch)
tree032a0e4701b4e13ee209162a3c4225c9c806c7a0 /lib/VNWeb/Discussions
parent162fe804937ccc5c45306043dc2da566d2782048 (diff)
Discussions: Mark notification as read when opening thread
Ideally this is done for every notification type, but I'll need to find a better way to do that...
Diffstat (limited to 'lib/VNWeb/Discussions')
-rw-r--r--lib/VNWeb/Discussions/Thread.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/VNWeb/Discussions/Thread.pm b/lib/VNWeb/Discussions/Thread.pm
index 9bff61bb..ed357b5d 100644
--- a/lib/VNWeb/Discussions/Thread.pm
+++ b/lib/VNWeb/Discussions/Thread.pm
@@ -182,6 +182,11 @@ TUWF::get qr{/$RE{tid}(?:/$RE{num})?}, sub {
GROUP BY tpo.id, tpo.option, tpm.optid'
);
+ # Mark a notification for this thread as read, if there is one.
+ tuwf->dbExeci(
+ 'UPDATE notifications SET read = NOW() WHERE uid =', \auth->uid, 'AND ltype = \'t\' AND iid = ', \$id, 'AND read IS NULL'
+ ) if auth && $t->{count} <= $page*25;
+
framework_ title => $t->{title}, sub {
metabox_ $t;
elm_ 'Discussions.Poll' => $POLL_OUT, {