Jump to:
| Project: | Fivestar |
| Version: | 6.x-1.19 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Issue Summary
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.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| fivestar.patch | 1.4 KB | Idle | PASSED: [[SimpleTest]]: [MySQL] 0 pass(es). | View details | Re-test |
Comments
#1
Have the same issue. Applied the patch. Works perfectly.
#2
Woot! Thanks for that--worked for me too! I really appreciate you tracking the problem down!
#3
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
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.
#5
I'm having the same issue with 6x 1.19. Since it's a different version, I'm hesitant to apply the patch.
Can you tell me how to clear a vote from the database? I've already deleted the comment, but it's still showing in the average.
Thanks for any assistance!
Dan
#6
Same here, an anonymous user can vote on my website, and no matter whether the comment is approved or immediately deleted by admin without ever being approved, the vote stays and it is visible to all users.
#7
Marked #601160: Comment-cast ratings not deleted with comment, which has a commit already, as a dupe of this.
#8
This patch works well for 6.x-1.19.
Also, #249547: Deleting a comment does not delete the attached vote. seems like a duplicate of this issue.
#9
What is the difference between the two patches
#10
Both patches address the issue of inserting and updating the vote properly (which allows it to be deleted eventually), but the patch in this thread adds the proper
fivestar_comment_delete()call, which actually deletes the comment#11
Thanks for the answer. Shouldn't the other issue be deleted completely then to avoid confusion?
#12
Good idea. Marked #249547: Deleting a comment does not delete the attached vote. as a duplicate of this.
#13
Correcting comment #7: #349900: Comment-cast ratings not deleted when comment is deleted. was marked as a dupe of this.
Confirm that original patch by penguin25 fixes this bug. (EDIT- And that the other patches floating around do not provide a complete fix.)