From a1a0c0bdb16fa85f3f6ad0f50185057e1fa0c7fb Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Mon, 19 Oct 2009 17:26:23 +0200 Subject: [PATCH] Possible to mark threads as unread --- lib/NDWeb/Controller/Forum.pm | 14 ++++++++++++++ root/src/forum/thread.tt2 | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/NDWeb/Controller/Forum.pm b/lib/NDWeb/Controller/Forum.pm index 4cca534..def82bb 100644 --- a/lib/NDWeb/Controller/Forum.pm +++ b/lib/NDWeb/Controller/Forum.pm @@ -294,6 +294,20 @@ sub markThreadAsRead : Private { } } +sub markThreadAsUnread : Local { + my ( $self, $c, $thread ) = @_; + my $dbh = $c->model; + + my ($fbid) = $dbh->selectrow_array(q{ +SELECT fbid FROM forum_threads WHERE ftid = $1 + },undef, $thread); + + $dbh->do(q{ +DELETE FROM forum_thread_visits WHERE uid = $1 AND ftid = $2 + }, undef, $c->user->id, $thread); + $c->res->redirect($c->uri_for('board',$fbid)); +} + sub moveThreads : Local { my ( $self, $c, $board ) = @_; my $dbh = $c->model; diff --git a/root/src/forum/thread.tt2 b/root/src/forum/thread.tt2 index 5668f8a..d282058 100644 --- a/root/src/forum/thread.tt2 +++ b/root/src/forum/thread.tt2 @@ -5,6 +5,10 @@ Make this thread [% thread.sticky ? 'unsticky' : 'sticky' %] [% END %] +[% IF c.user.id %] +Mark thread as unread +[% END %] + [% createNewPostHr = 1 %] [% FOR post IN posts %] [% IF createNewPostHr AND post.unread%] @@ -18,6 +22,10 @@ [% END %] +[% IF c.user.id %] +Mark thread as unread +[% END %] + [% IF thread.post %]
New Reply -- 2.39.2