From 087b1697606292d945524af4f84ba5899749409e Mon Sep 17 00:00:00 2001 From: Yorhel Date: Tue, 7 Jul 2009 13:18:50 +0200 Subject: Hide threads targeted at users from the main page --- lib/VNDB/DB/Discussions.pm | 4 +++- lib/VNDB/Handler/Misc.pm | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm index b28bfeab..78a462df 100644 --- a/lib/VNDB/DB/Discussions.pm +++ b/lib/VNDB/DB/Discussions.pm @@ -8,7 +8,7 @@ use Exporter 'import'; our @EXPORT = qw|dbThreadGet dbThreadEdit dbThreadAdd dbPostGet dbPostEdit dbPostAdd dbThreadCount|; -# Options: id, type, iid, results, page, what +# Options: id, type, iid, results, page, what, notusers # What: boards, boardtitles, firstpost, lastpost sub dbThreadGet { my($self, %o) = @_; @@ -26,6 +26,8 @@ sub dbThreadGet { 't.id IN(SELECT tid FROM threads_boards WHERE type = ?)' => $o{type} ) : (), $o{type} && $o{iid} ? ( 'tb.type = ?' => $o{type}, 'tb.iid = ?' => $o{iid} ) : (), + $o{notusers} ? ( + 't.id NOT IN(SELECT tid FROM threads_boards WHERE type = \'u\')' => 1) : (), ); my @select = ( diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm index dd9c8307..9ff2d315 100644 --- a/lib/VNDB/Handler/Misc.pm +++ b/lib/VNDB/Handler/Misc.pm @@ -100,7 +100,7 @@ sub homepage { # Recent posts div class => 'mainbox threelayout last'; h1 'Recent posts'; - my $posts = $self->dbThreadGet(what => 'lastpost boardtitles', results => 10, order => 'tpl.date DESC'); + my $posts = $self->dbThreadGet(what => 'lastpost boardtitles', results => 10, order => 'tpl.date DESC', notusers => 1); ul; for (@$posts) { my $boards = join ', ', map $self->{discussion_boards}{$_->{type}}.($_->{iid}?' > '.$_->{title}:''), @{$_->{boards}}; -- cgit v1.2.3