]> ruin.nu Git - ndwebbie.git/blobdiff - ND/Web/Forum.pm
only put old message in text field when previewing, not after submitting
[ndwebbie.git] / ND / Web / Forum.pm
index 59b8625c0526382c657f5f4f2d1e70d1649fc49a..76adfb2915560654bf96268d48d6d32751204605 100644 (file)
@@ -37,7 +37,7 @@ sub viewForumThread {
        $template->param(Id => $thread->{id});
        $template->param(Post => $thread->{post});
 
-       my $posts = $ND::DBH->prepare(q{SELECT u.username,date_trunc('minute',fp.time::timestamp) AS time,fp.message,COALESCE(fp.time > ftv.time,TRUE) AS unread
+       my $posts = $ND::DBH->prepare(q{SELECT u.username,date_trunc('seconds',fp.time::timestamp) AS time,fp.message,COALESCE(fp.time > ftv.time,TRUE) AS unread
 FROM forum_threads ft JOIN forum_posts fp USING (ftid) JOIN users u USING (uid) LEFT OUTER JOIN (SELECT * FROM forum_thread_visits WHERE uid = $2) ftv ON ftv.ftid = ft.ftid
 WHERE ft.ftid = $1
 ORDER BY fp.time ASC
@@ -58,9 +58,9 @@ ORDER BY fp.time ASC
                my $text = parseMarkup(escapeHTML(param('message')));
                $text .= p b $@ if $@;
                push @posts,{message => $text, unread => 1, username => 'PREVIEW', Time => 'Not submitted yet', NewPosts => $old ? 1 : 0};
+               $template->param(Message => param('message'));
        }
        $template->param(Posts => \@posts);
-       $template->param(Message => param('message'));
 
        markThreadAsRead($thread->{id});