diff options
author | Yorhel <git@yorhel.nl> | 2020-08-06 13:22:55 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-08-06 13:30:20 +0200 |
commit | 14fa9431498e7102ba772549570851839df93f4e (patch) | |
tree | b14e3545c23daa716b6c4a5a0c41e8945f4e0fae /lib/VNDB | |
parent | 55fd685c182397616be8c5af1d8db996b1d2d9b1 (diff) |
Discussions: Allow discontinuous post numbers + ignore hidden posts in counts/lastpost
This solves a few problems:
- 'hidden' posts will no longer cause the thread to be bumped to the
front page.
- Deleting posts will no longer cause other posts to be renumbered (and
hence will not break existing links to posts)
- Numbers of deleted posts will no longer be re-used (except when they
were the last post in the thread - fixing this would require an
additional column in 'threads', but it didn't seem worth the trouble)
Diffstat (limited to 'lib/VNDB')
-rw-r--r-- | lib/VNDB/DB/Discussions.pm | 4 | ||||
-rw-r--r-- | lib/VNDB/Handler/Misc.pm | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm index 442f8032..0cc05303 100644 --- a/lib/VNDB/DB/Discussions.pm +++ b/lib/VNDB/DB/Discussions.pm @@ -40,14 +40,14 @@ sub dbThreadGet { } my @select = ( - qw|t.id t.title t.count t.locked t.hidden t.private|, 't.poll_question IS NOT NULL AS haspoll', + qw|t.id t.c_lastnum t.title t.locked t.hidden t.private|, 't.poll_question IS NOT NULL AS haspoll', $o{what} =~ /lastpost/ ? (q|EXTRACT('epoch' from tpl.date) AS lastpost_date|, VNWeb::DB::sql_user('ul', 'lastpost_')) : (), $o{what} =~ /poll/ ? (qw|t.poll_question t.poll_max_options t.poll_preview t.poll_recast|) : (), ); my @join = ( $o{what} =~ /lastpost/ ? ( - 'JOIN threads_posts tpl ON tpl.tid = t.id AND tpl.num = t.count', + 'JOIN threads_posts tpl ON tpl.tid = t.id AND tpl.num = t.c_lastnum', 'JOIN users ul ON ul.id = tpl.uid' ) : (), $o{type} && $o{iid} ? diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm index 70588d45..c316999d 100644 --- a/lib/VNDB/Handler/Misc.pm +++ b/lib/VNDB/Handler/Misc.pm @@ -122,7 +122,7 @@ sub homepage { my $boards = join ', ', map $BOARD_TYPE{$_->{type}}{txt}.($_->{iid}?' > '.$_->{title}:''), @{$_->{boards}}; li; txt fmtage($_->{lastpost_date}).' '; - a href => "/$_->{id}.$_->{count}#last", title => "Posted in $boards", shorten $_->{title}, 25; + a href => "/$_->{id}.$_->{c_lastnum}#last", title => "Posted in $boards", shorten $_->{title}, 25; lit ' by '; VNWeb::HTML::user_($_, 'lastpost_'); end; |