Fix direct linking to posts and threads when their pagination is set to 0. Fixes bug #11464.

This commit is contained in:
Colin Kuskie 2010-03-10 09:45:37 -08:00
parent eccf6a5021
commit 21e321012c
4 changed files with 12 additions and 3 deletions

View file

@ -506,7 +506,8 @@ Returns the URL for this Post, which links directly to its anchor and page.
sub getThreadLinkUrl {
my $self = shift;
my $url;
my $page_size = $self->getThread->getParent->get('postsPerPage');
my $paginator = WebGUI::Paginator->new($self->session, '', $self->getThread->getParent->get('postsPerPage'));
my $page_size = $paginator->{_rpp}; ##To make sure defaults are handled correctly.
my $place = $self->getRank+1;
my $page = int($place/$page_size) + 1;
my $page_frag = 'pn='.$page;

View file

@ -352,7 +352,8 @@ sub getCSLinkUrl {
my $self = shift;
my $url;
my $cs = $self->getParent;
my $page_size = $cs->get('threadsPerPage');
my $paginator = WebGUI::Paginator->new($self->session, '', $self->getParent->get('threadsPerPage'));
my $page_size = $paginator->{_rpp}; ##To make sure defaults are handled correctly.
my $place = $self->getRank+1;
my $last_place = $cs->getLastChild->getRank+1;
my $page = int(($last_place - $place)/$page_size) + 1;