Merge commit '17ce3572bf' into WebGUI8. All tests passing.
This commit is contained in:
commit
5e502fee53
117 changed files with 2012 additions and 1027 deletions
|
|
@ -119,8 +119,8 @@ sub _fixReplyCount {
|
|||
isa => 'WebGUI::Asset::Post',
|
||||
orderByClause => 'assetData.revisionDate desc',
|
||||
} )->[0];
|
||||
|
||||
if (my $lastPost = WebGUI::Asset->newById( $self->session, $lastPostId ) ) {
|
||||
my $lastPost = eval { WebGUI::Asset->newById( $self->session, $lastPostId ); };
|
||||
if ( ! Exception::Class->caught() ) {
|
||||
$asset->incrementReplies( $lastPost->revisionDate, $lastPost->getId );
|
||||
}
|
||||
else {
|
||||
|
|
@ -292,23 +292,30 @@ the parent thread.
|
|||
=cut
|
||||
|
||||
override cut => sub {
|
||||
warn "post's cut";
|
||||
my $self = shift;
|
||||
|
||||
# Fetch the Thread and CS before cutting the asset.
|
||||
my $thread = $self->getThread;
|
||||
warn "got thread";
|
||||
my $cs = $thread->getParent;
|
||||
warn "got cs";
|
||||
|
||||
# Cut the asset
|
||||
my $result = super();
|
||||
warn "called super";
|
||||
|
||||
# If a post is being cut update the thread reply count first
|
||||
if ($thread->getId ne $self->getId) {
|
||||
warn "calling _fixReplyCount on thread";
|
||||
$self->_fixReplyCount( $thread );
|
||||
}
|
||||
|
||||
# Update the CS reply count. This step is also necessary when a Post is cut since the Thread's incrementReplies
|
||||
# also calls the CS's incrementReplies, possibly with the wrong last post Id.
|
||||
warn "calling _fixReplyCount on cs";
|
||||
$self->_fixReplyCount( $cs );
|
||||
warn "all should be well...?";
|
||||
|
||||
return $result;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue