Multiple votingapi_widgets fields on a same entity leads to vote removal because of Vote::preSave

Created on 18 February 2019, about 6 years ago
Updated 20 March 2025, 14 days ago

Votingapi Entity Drupal\votingapi\Entity\Vote has a preSave method which removes previous votes from the user if he already voted on the same entity. It obviously ignores field_name column added by votingapi_widgets.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine artem_sylchuk Lutsk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States loze Los Angeles
  • πŸ‡ΊπŸ‡ΈUnited States loze Los Angeles

    It appears that there is no longer a preSave() method in Drupal\votingapi\Entity\Vote

    @tr is this still relevant?

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    I have looked back through the commits, and \Drupal\votingapi\Entity\Vote *never* had its own preSave() method, even as far back as 2019 when this issue was opened.

    So I'm going to assume the issue summary is just inaccurate, but I don't think I can assume that the problem doesn't exist.

    I suspect this is still relevant, but it is something that someone should try to reproduce. We need specific clear directions that spell out what steps need to be taken to cause this problem. It seems that you need at least two votingapi_widget fields of different types attached to the entity, but then what steps need to be taken to make this problem appear? Where does the "remove previous votes from the user if he already voted on the same entity" happen?

    Then if it's still a problem we should have a test to demonstrate the problem, and then we can talk about a solution. I'm not a fan of overriding the votingapi Vote entity like this patch does - if this is still a problem then perhaps we ought to change the votingapi module to recognize and support multiple types of votes on the same entity.

  • πŸ‡ΊπŸ‡ΈUnited States loze Los Angeles

    for the record, I have not been able to reproduce it myself.

Production build 0.71.5 2024