diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 66bdefc97..ab4e2a8fc 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -13,6 +13,7 @@ - fix: HttpProxy now handles styles appropriately. - fix: op=viewPurchaseHistory prices are now formatted correctly - fix: A minor bug in the default viewPurchaseHistory template + - fix: Thread determination of "current" Post, and shortcuts to non-Thread Posts 7.2.1 - Made a change to version tag commits to deal with unusually long commit diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 38ef678c2..9e7be19b6 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -979,10 +979,19 @@ sub update { } #------------------------------------------------------------------- +sub prepareView { + my $self = shift; + $self->SUPER::prepareView; + unless ($self->getThread->getId eq $self->getId) { + # Need the unless to avoid infinite recursion. + $self->getThread->prepareView; + } +} + sub view { my $self = shift; $self->incrementViews; - return $self->getThread->view; + return $self->getThread->view($self); } diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index 66e6c7037..5d20f89a6 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -770,6 +770,7 @@ sub unsubscribe { #------------------------------------------------------------------- sub view { my $self = shift; + my $currentPost = shift || $self; $self->markRead; $self->incrementViews unless ($self->session->form->process("func") eq 'rate'); if ($self->session->user->userId eq '1' && !$self->session->form->process("layout")) { @@ -852,7 +853,7 @@ sub view { my $reply = WebGUI::Asset::Post->new($self->session, $dataSet->{assetId}, $dataSet->{className}, $dataSet->{revisionDate}); $reply->{_thread} = $self; # caching thread for better performance my %replyVars = %{$reply->getTemplateVars}; - $replyVars{isCurrent} = ($reply->get("url") eq $currentPageUrl); + $replyVars{isCurrent} = ($reply->getId eq $currentPost->getId); $replyVars{isThreadRoot} = $self->getId eq $reply->getId; $replyVars{depth} = $reply->getLineageLength - $self->getLineageLength; $replyVars{depthX10} = $replyVars{depth}*10;