Fix more thread search pagination issues.

This commit is contained in:
Colin Kuskie 2010-03-20 21:48:09 -07:00
parent 261c8b30da
commit c0206e61f5
4 changed files with 9 additions and 4 deletions

View file

@ -6,6 +6,7 @@
- fixed #11476: Missing override in Page Layout shortcut
- fixed: Unable to add threads with permission to edit CS but not in post group
- fixed #11478: Overzealous removal of double slashes in FilePump macro
- fixed thread pagination on search results, off by 1 error and modal direction
7.9.0
- added #11383: AJAX username checks at registration (Luke Robinson / Orchard Solutions)

View file

@ -19,6 +19,7 @@ use WebGUI::International;
use WebGUI::Paginator;
use WebGUI::SQL;
use WebGUI::Utility;
use POSIX qw/ceil/;
our @ISA = qw(WebGUI::Asset::Post);
@ -383,7 +384,7 @@ EOSQL
}
$sth->finish;
return $self->get('url') if !$found;
my $page = int($place/$page_size) + 1;
my $page = ceil($place/$page_size);
my $page_frag = 'pn='.$page.';sortBy=lineage;sortOrder=desc';
$url = $session->url->append($cs->get('url'), $page_frag);
return $url;

View file

@ -1173,7 +1173,7 @@ sub getThreadsPaginator {
$self->session->scratch->set($scratchSortBy,$self->session->form->process("sortBy"));
$self->session->scratch->set($scratchSortOrder, $sortOrder);
}
elsif ($self->session->form->process("sortBy") && $self->session->form->process("func") ne "editSave") {
elsif ($self->session->form->process("sortBy") && $self->session->form->process("func") ne "editSave" && ! $self->session->form->process('sortOrder')) {
if ($sortOrder eq "asc") {
$sortOrder = "desc";
}

View file

@ -13,7 +13,7 @@ use strict;
use lib "$FindBin::Bin/../../lib";
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 12; # increment this value for each test you create
use Test::More tests => 15; # increment this value for each test you create
use Test::MockObject::Extends;
use Test::Exception;
use WebGUI::Asset::Wobject::Collaboration;
@ -88,8 +88,11 @@ $versionTag2->commit;
my $csUrl = $collab->get('url');
like $newThreads[-1]->getCSLinkUrl, qr/^$csUrl/, 'getCsLinkUrl returns URL of the parent CS with no gateway';
like $newThreads[-1]->getCSLinkUrl, qr/\?pn=1/, 'and has the right page number';
like $newThreads[-1]->getCSLinkUrl, qr/\?pn=1/, '... and has the right page number';
like $newThreads[-1]->getCSLinkUrl, qr/\?pn=1;sortBy=lineage;sortOrder=desc/, 'and has the right sort parameters';
like $newThreads[-2]->getCSLinkUrl, qr/\?pn=1/, '... second to last has right page number';
like $newThreads[-3]->getCSLinkUrl, qr/\?pn=1/, '... and third to last';
like $newThreads[-4]->getCSLinkUrl, qr/\?pn=2/, '... and fourth to last';
$thread->restore();
like $thread->getCSLinkUrl, qr/\?pn=6/, 'checking 2nd thread on another page';