As designed Deleting Ratings

Luehrsen

Member
Affected version
2.2.1
Short: Deleting a Rating-Comment does not delete the rating itself.

How to reproduce:
1) Leave a star-rating on a media item with a comment.
2) Delete (soft or hard) that comment with the rating from that media item. (through /media/comments/xx/delete)
3) The rating_avg and and rating_count does not update after rebuilding caches through xf-rebuild:xfmg-media-items.

The issue at hand is not a cache issue. After deleting the comment the actual rating is still present in xf_mg_rating. Hard deleting that rating from the database and flushing the caches creates the desired outcome.

It seems like the _postDelete hook in the Rating Entity is never called.
 
I don't necessarily agree that this is a bug, though it may be something you want to add as a suggestion for consideration in the future.

We do not provide any system for managing/moderating the ratings that have been left on a media item. So in a case where a rating is left without a comment, there's no way to remove said rating either.

When you delete a comment that was left with a rating, you are literally just deleting the comment. We didn't intend for it to delete the rating as well.

So currently this is expected but a way to manage ratings may be something that we want to consider in the future.
 
Top Bottom