plainblack.com
Username Password
search
Bookmark and Share
View All Tickets
CS #replies does not get updated after post restore from trash  (#10758)
Issue

When you delete a post and restore it from the trash, the number of replies of the Thread does not get updated.

Found it in 7.7.16 at wre 0.93 on debian, may need backporting to 7.6

Solution Summary
Added code to make Threads recalculate their number of replies after the Post has been restored.
Comments
bartjol
4
8/12/2009 11:24 am
made a patch:
line 478-479 in AssetTrash.pm becomes:
               $asset->publish if $asset->canEdit;
               if ($asset->get('className') eq "WebGUI::Asset::Post") {
                   $asset->getThread->sumReplies;
               }
       }

tested it on 7.7.16 and it works, if it's crappy for some reason, please notify, I can only learn
bartjol
0
8/13/2009 2:31 am
ok I heard from Colin that this was not a bad fix, but not the desired place, since it was to specific pointing to 1 asset in a general asset script.

I was wondering whether it might be an idea to instad include a $asset->doOnRecovery function in the same script, even same place which refers to the Asset code. That way there is a general script with the implementation in the asset itself. This will not be ncessary for every asset, so a check whether the method exist will also be necessary.

Second plan: the recovery method of AssetTrash sets the state to isRecovered and a workflow is triggered to check for this state and do stuff for the asset that needs to be done on recovery
bartjol
0
8/17/2009 5:16 pm
ok , solution exists of three parts:
1 an extra sub restore that does the publishing for assets in AssetTrash.pm
2 removed that from www_restoreList) in AssetTrash.pm
3 extra restore sub in Post.pm that refers to the sub mentioned in 1 and after recounts for the thread

1 add code in AssetTrash.pm
=head2 restore

Publishes assets from the trash

=cut

sub restore {
       my $self = shift;
       $self->publish if $self->canEdit;

}

2 replace inAssetTrash.pm
       $asset->publish if $asset->canEdit;
with
      $asset->restore;

3 add code in Asset/Post.pm
=head2 restore

Takes actions when asset is restored from trash, with Post, it recounts the total replies to the thread

=cut

sub restore {
       my $self = shift;
       $self->SUPER::restore(@_);
       $self->getThread->sumReplies;
}

This is also an API change  
perlDreamer
0
8/17/2009 5:27 pm
Fixed in 7.7.18 by Bart Jol.
Resolved by perlDreamer
bartjol
0
8/18/2009 7:22 am
related to this, should thread ratings also be recalculated on deleting and restoring?
Please notify me via a private message or irc , then I can report a bug, or not.
Details
Ticket Status Closed  
Rating4.0 
Submitted Bybartjol 
Date Submitted2009-08-12 
Assigned To unassigned  
Date Assigned2019-08-25 
Assigned By 
Severity Minor (annoying, but not harmful)  
What's the bug in? WebGUI Beta  
WebGUI / WRE Version  
URLuse/bugs/tracker/10758
Keywords
Ticket History
8/18/2009
12:22 PM
Closed bartjol
8/17/2009
10:27 PM
Resolved perlDreamer
8/12/2009
3:37 PM
Ticket created bartjol
© 2019 Plain Black Corporation | All Rights Reserved