Problems with deleting ratings in fivestar_comment

penguin25 - October 10, 2009 - 22:37
Project:Fivestar
Version:6.x-1.18
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Description

I've been seeing problems whereby if a user has rated content from within a comment via the fivestar_comment module, and then tries to edit the comment to remove the rating, it is not properly deleted.

What happens is that although the rating is removed from the comment, it remains in the main votingapi data structures and so is still included in things like the average rating.

Having looked through the code, it appears there are two problems:
1) At one point where fivestar_comment_delete() is called, it is being passed a user_id instead of a vote_id.
2) Vote IDs are not being stored in the fivestar_comment database table properly, and so even after fixing (1), the correct vote_id is still not used to try and delete the vote.

I've attached a patch that fixes both these issues (although it obviously won't fix any existing bad entries in the database).

For reference, I'm using fivestar-6.x-1.18 and votingapi-6.x-2.3.

AttachmentSize
fivestar.patch1.4 KB

#1

lonelyrobot - October 15, 2009 - 02:45
Status:active» reviewed & tested by the community

Have the same issue. Applied the patch. Works perfectly.

#2

daneyuleb - October 23, 2009 - 22:03

Woot! Thanks for that--worked for me too! I really appreciate you tracking the problem down!

#3

MatteNoob - October 27, 2009 - 02:51

This was an amazing patch, thank you! You solved a problem I've been ripping my hair out to solve! You are my #1 hero! WOOOHOOO! :D

For refrence: I used the same versions as the "patchman" :)

#4

sedmi - November 3, 2009 - 13:04
Status:reviewed & tested by the community» needs work

I have tried patch, and it works for deletion of registered user's vote. But if anonymous users are allowed to vote and their comment plus vote is deleted, average isn't updated, it still registers a vote.

 
 

Drupal is a registered trademark of Dries Buytaert.