Do max_pages for threads
This commit is contained in:
parent
b11a616d90
commit
16a561346d
|
@ -61,7 +61,7 @@ tests locally:
|
|||
|
||||
## TODOs
|
||||
|
||||
1. Hide ancient posts
|
||||
1. Hide ancient posts (test this, dev DB is broken fuck)
|
||||
1. Put a link to search_page somewhere
|
||||
1. "All new posts flagged" mode (require approval for new posts)
|
||||
1. Tests for mod-only user?
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
max_thread_pages => 10,
|
||||
threads_per_page => 5,
|
||||
remarks_per_page => 5,
|
||||
results_per_page => 5,
|
||||
|
|
|
@ -104,6 +104,10 @@ sub startup($self) {
|
|||
$self->page->per_page($results_per_page)
|
||||
}
|
||||
|
||||
if (my $max_thread_pages = $self->config->{'max_thread_pages'}) {
|
||||
$self->thread->max_pages($max_thread_pages)
|
||||
}
|
||||
|
||||
$self->asset->process;
|
||||
|
||||
push @{$self->commands->namespaces}, 'PostText::Command';
|
||||
|
|
|
@ -2,7 +2,7 @@ package PostText::Model::Thread;
|
|||
|
||||
use Mojo::Base -base, -signatures;
|
||||
|
||||
has [qw{pg hr}];
|
||||
has [qw{pg hr max_pages}];
|
||||
|
||||
has per_page => 5;
|
||||
|
||||
|
@ -57,7 +57,11 @@ sub last_page($self) {
|
|||
# Add a page for 'remainder' posts
|
||||
$last_page++ if $thread_count % $self->per_page;
|
||||
|
||||
$last_page;
|
||||
if ($max_pages) {
|
||||
$last_page = $max_pages if $last_page > $max_pages
|
||||
}
|
||||
|
||||
return $last_page;
|
||||
}
|
||||
|
||||
sub count($self) {
|
||||
|
|
Loading…
Reference in a new issue