Threads should not show pagination query params in their URLs.
This commit is contained in:
parent
2605a4c989
commit
b5f5f8f6e8
3 changed files with 28 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
7.8.10
|
7.8.10
|
||||||
|
- fixed #11332: Pagination in webgui.org forum urls
|
||||||
|
|
||||||
7.8.9
|
7.8.9
|
||||||
- fixed #11235: wiki search
|
- fixed #11235: wiki search
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,26 @@ sub getAutoCommitWorkflowId {
|
||||||
return $self->getThread->getParent->get("threadApprovalWorkflow");
|
return $self->getThread->getParent->get("threadApprovalWorkflow");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 getDirectLinkUrl ( )
|
||||||
|
|
||||||
|
Extend the base method from Post to remove the pagination query fragment
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub getDirectLinkUrl {
|
||||||
|
my $self = shift;
|
||||||
|
my $url = $self->SUPER::getDirectLinkUrl();
|
||||||
|
$url =~ s/\?pn=\d+//;
|
||||||
|
if ($url =~ m{;revision=\d+}) {
|
||||||
|
$url =~ s/;revision/?revision/;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 getLastPost
|
=head2 getLastPost
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use strict;
|
||||||
use lib "$FindBin::Bin/../../lib";
|
use lib "$FindBin::Bin/../../lib";
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use Test::More tests => 2; # increment this value for each test you create
|
use Test::More tests => 5; # increment this value for each test you create
|
||||||
use Test::MockObject::Extends;
|
use Test::MockObject::Extends;
|
||||||
use WebGUI::Asset::Wobject::Collaboration;
|
use WebGUI::Asset::Wobject::Collaboration;
|
||||||
use WebGUI::Asset::Post::Thread;
|
use WebGUI::Asset::Post::Thread;
|
||||||
|
|
@ -44,6 +44,8 @@ my $thread = $collab->addChild($props, @addArgs);
|
||||||
|
|
||||||
$versionTag->commit();
|
$versionTag->commit();
|
||||||
|
|
||||||
|
my $uncommittedThread = $collab->addChild($props, @addArgs);
|
||||||
|
|
||||||
# Test for a sane object type
|
# Test for a sane object type
|
||||||
isa_ok($thread, 'WebGUI::Asset::Post::Thread');
|
isa_ok($thread, 'WebGUI::Asset::Post::Thread');
|
||||||
|
|
||||||
|
|
@ -61,4 +63,8 @@ $thread->rate(1);
|
||||||
$thread->trash;
|
$thread->trash;
|
||||||
is($thread->get('threadRating'), 0, 'trash does not die, and updates the threadRating to 0');
|
is($thread->get('threadRating'), 0, 'trash does not die, and updates the threadRating to 0');
|
||||||
|
|
||||||
|
unlike $thread->getDirectLinkUrl, qr/\?pn=\d+/, 'threads do not need pagination url query fragments';
|
||||||
|
unlike $uncommittedThread->getDirectLinkUrl, qr/\?pn=\d+/, 'uncommitted threads, too';
|
||||||
|
like $uncommittedThread->getDirectLinkUrl, qr/\?revision=\d+/, 'uncommitted threads do have a revision query param';
|
||||||
|
|
||||||
# vim: syntax=perl filetype=perl
|
# vim: syntax=perl filetype=perl
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue