X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=lib%2FNDWeb%2FController%2FForum.pm;h=0a27acc7547ae88e11d29a4d8685e939e70f447e;hb=2c69d5fa71e2b4ddf7c9f5fa1880a9c69f70e43a;hp=4145781c7c2e346a69f5e7b618fd78d258cf259c;hpb=95365cc1a5b8827230e5213bf4dd3377949af7f0;p=ndwebbie.git 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; }