X-Git-Url: https://ruin.nu/git/?p=ndwebbie.git;a=blobdiff_plain;f=lib%2FNDWeb%2FController%2FForum.pm;h=0a27acc7547ae88e11d29a4d8685e939e70f447e;hp=4145781c7c2e346a69f5e7b618fd78d258cf259c;hb=11149303e8c0c031f5e08c5792930b490ba4a30b;hpb=80ad5ca3ad49aa9cc029fe3baaff513e422ef499 diff --git a/lib/NDWeb/Controller/Forum.pm b/lib/NDWeb/Controller/Forum.pm index 4145781..0a27acc 100644 --- a/lib/NDWeb/Controller/Forum.pm +++ b/lib/NDWeb/Controller/Forum.pm @@ -208,7 +208,13 @@ sub thread : Local { my $dbh = $c->model; $c->forward('findThread'); - $thread = $c->stash->{thread}; + $c->forward('findPosts') if $c->stash->{thread}; + $c->forward('markThreadAsRead') if $c->user_exists; +} + +sub findPosts :Private { + my ( $self, $c, $thread ) = @_; + my $dbh = $c->model; my $posts = $dbh->prepare(q{ SELECT u.username,date_trunc('seconds',fp.time::timestamp) AS time @@ -221,7 +227,7 @@ sub thread : Local { WHERE ft.ftid = $1 ORDER BY fp.time ASC }); - $posts->execute($c->stash->{thread}->{ftid},$c->stash->{UID}); + $posts->execute($thread,$c->stash->{UID}); my @posts; while (my $post = $posts->fetchrow_hashref){ @@ -230,7 +236,6 @@ sub thread : Local { } $c->stash(posts => \@posts); - $c->forward('markThreadAsRead') if $c->user_exists; }