diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 2c16fdd52..0db3352a4 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.7.18 + - fixed #10758: CS #replies does not get updated after post restore from trash (Bart Jol / Procolix) - fixed #10781: User Profile Editable/Required gotcha - fixed #10786: Matrix navigation: search screen to view screen - fixed #10766: Matrix search: search dropdowns do not match what is displayed when search form opens. diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 0057140d4..5c0e07150 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -1251,6 +1251,21 @@ sub recalculatePostRating { $self->update({rating=>$sum}); } +#------------------------------------------------------------------- + +=head2 restore + +Extend the base class to also make the thread containing this post to recalculate its replies + +=cut + +sub restore { + my $self = shift; + $self->SUPER::restore(@_); + $self->getThread->sumReplies; +} + + #------------------------------------------------------------------- =head2 rethreadUnder ($thread) diff --git a/lib/WebGUI/AssetTrash.pm b/lib/WebGUI/AssetTrash.pm index d7860f737..18cbd6a4d 100644 --- a/lib/WebGUI/AssetTrash.pm +++ b/lib/WebGUI/AssetTrash.pm @@ -216,6 +216,20 @@ sub purge { } +#------------------------------------------------------------------- + +=head2 restore + +Publishes assets from the trash. + +=cut + +sub restore { + my $self = shift; + $self->publish; +} + + #------------------------------------------------------------------- =head2 trash ( $options ) @@ -479,7 +493,7 @@ sub www_restoreList { my $self = shift; foreach my $id ($self->session->form->param("assetId")) { my $asset = eval { WebGUI::Asset->newPending($self->session,$id); }; - $asset->publish if $asset->canEdit; + $asset->restore if $asset->canEdit; } if ($self->session->form->process("proceed") ne "") { my $method = "www_".$self->session->form->process("proceed");