Make Threads recalculate the number of replies when restoring a Post from the Trash.

Fixes bug #10758.
This commit is contained in:
Colin Kuskie 2009-08-17 22:25:24 +00:00
parent 0762ce1730
commit 0511af269d
3 changed files with 31 additions and 1 deletions

View file

@ -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.

View file

@ -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)

View file

@ -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");