]> ruin.nu Git - ndwebbie.git/commitdiff
Possible to mark threads as unread
authorMichael Andreen <harv@ruin.nu>
Mon, 19 Oct 2009 15:26:23 +0000 (17:26 +0200)
committerMichael Andreen <harv@ruin.nu>
Mon, 19 Oct 2009 15:26:23 +0000 (17:26 +0200)
lib/NDWeb/Controller/Forum.pm
root/src/forum/thread.tt2

index 4cca534c3f7e2137cda1f3640dffed7d1edf2d7d..def82bb5dc12c3690af46e406d884da115a1961c 100644 (file)
@@ -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;
index 5668f8a25e222c082be59dc4bf4841d76da4c251..d2820580ffd06da3ce3da1c30de11a5d5942286c 100644 (file)
@@ -5,6 +5,10 @@
 <a href="[% c.uri_for('setSticky',thread.ftid, (thread.sticky ? 0 : 1)) %]">Make this thread [% thread.sticky ? 'unsticky' : 'sticky' %]</a>
 [% END %]
 
+[% IF c.user.id %]
+<a href="[% c.uri_for('markThreadAsUnread',thread.ftid) %]">Mark thread as unread</a>
+[% END %]
+
 [% createNewPostHr = 1 %]
 [% FOR post IN posts %]
        [% IF createNewPostHr AND post.unread%]
 </fieldset>
 [% END %]
 
+[% IF c.user.id %]
+<a href="[% c.uri_for('markThreadAsUnread',thread.ftid) %]">Mark thread as unread</a>
+[% END %]
+
 [% IF thread.post %]
 <form action="[% c.uri_for('addPost',thread.ftid) %]#NewPosts" method="post"><fieldset class="forum-post"> <legend><a name="Reply">New Reply</a></legend>
        <textarea class="bbcode" rows="25" cols="60" name="message" id="replybox">[% previewMessage %]</textarea>